drasys.or.linear.algebra
Class Algebra

java.lang.Object
  |
  +--drasys.or.linear.algebra.Algebra

public class Algebra
extends java.lang.Object
implements AlgebraI, java.io.Serializable

Smart linear algebra operations. These algebraic operations are analagous to the drasys.or.linear.blas, but operate on all vector and matrix classes. Each method checks the class type and sparcity of the arguments to determine the best way to perform the operation.

References:

Linear Algebra and Its Applications
    Gilbert Strang / Hardcover / Published 1988
Matrix Computations (Johns Hopkins Studies in the Mathematical Sciences)
    Gene H. Golub, Charles F. Van Loan (Contributor) / Paperback / Published 1996
Numerical Recipes in C : The Art of Scientific Computing
    William H. Press, et al / Hardcover / Published 1993
Parallel Algorithms for Matrix Computations
    K.A. Gallivan / Paperback / Published 1990

See Also:
Serialized Form

Constructor Summary
Algebra()
          Create new object with default instances of the BLAS.
Algebra(VectorBLAS1 blas1, MatrixBLAS2 blas2, MatrixBLAS3 blas3)
          Create new object with BLAS computations enabled and default instances of the BLAS.
 
Method Summary
 DenseMatrix add(MatrixI a, MatrixI b)
          Add two matrices.
 DenseVector add(VectorI a, VectorI b)
          Add two vectors.
 DenseMatrix invert(MatrixI a)
          Invert a matrix.
 DenseMatrix matrixProduct(VectorI columnVector, VectorI rowVector)
          Compute the matrix product of a column vector and a row vector.
 DenseMatrix multiply(MatrixI a, MatrixI b)
          Multiply two matrices.
 DenseVector multiply(MatrixI a, VectorI b)
          Multiply a matrix by column vector.
 DenseVector multiply(VectorI a, MatrixI b)
          Multiply a row vector by matrix.
 double scalerProduct(VectorI a, VectorI b)
          Compute the dot product two vectors.
 DenseMatrix subtract(MatrixI a, MatrixI b)
          Subtract two matrices.
 DenseVector subtract(VectorI a, VectorI b)
          Subtract two vectors.
 DenseMatrix transpose(MatrixI a)
          Transpose a matrix.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Algebra

public Algebra()
Create new object with default instances of the BLAS.

Algebra

public Algebra(VectorBLAS1 blas1,
               MatrixBLAS2 blas2,
               MatrixBLAS3 blas3)
Create new object with BLAS computations enabled and default instances of the BLAS. If one of the BLAS arguments is null then that BLAS will not be used.
Method Detail

add

public DenseMatrix add(MatrixI a,
                       MatrixI b)
                throws AlgebraException
Add two matrices.
Specified by:
add in interface AlgebraI
Throws:
AlgebraException - if the sizes don't match.

subtract

public DenseMatrix subtract(MatrixI a,
                            MatrixI b)
                     throws AlgebraException
Subtract two matrices.
Specified by:
subtract in interface AlgebraI
Throws:
AlgebraException - if the sizes don't match.

multiply

public DenseMatrix multiply(MatrixI a,
                            MatrixI b)
                     throws AlgebraException
Multiply two matrices.
Specified by:
multiply in interface AlgebraI
Throws:
AlgebraException - if the sizes don't match.

multiply

public DenseVector multiply(VectorI a,
                            MatrixI b)
                     throws AlgebraException
Multiply a row vector by matrix.
Specified by:
multiply in interface AlgebraI
Throws:
AlgebraException - if the sizes don't match.

multiply

public DenseVector multiply(MatrixI a,
                            VectorI b)
                     throws AlgebraException
Multiply a matrix by column vector.
Specified by:
multiply in interface AlgebraI
Throws:
AlgebraException - if the sizes don't match.

add

public DenseVector add(VectorI a,
                       VectorI b)
                throws AlgebraException
Add two vectors.
Specified by:
add in interface AlgebraI
Throws:
AlgebraException - if the sizes don't match.

subtract

public DenseVector subtract(VectorI a,
                            VectorI b)
                     throws AlgebraException
Subtract two vectors.
Specified by:
subtract in interface AlgebraI
Throws:
AlgebraException - if the sizes don't match.

matrixProduct

public DenseMatrix matrixProduct(VectorI columnVector,
                                 VectorI rowVector)
                          throws AlgebraException
Compute the matrix product of a column vector and a row vector.
Specified by:
matrixProduct in interface AlgebraI
Throws:
AlgebraException - if the sizes don't match.

scalerProduct

public double scalerProduct(VectorI a,
                            VectorI b)
                     throws AlgebraException
Compute the dot product two vectors.
Specified by:
scalerProduct in interface AlgebraI
Throws:
AlgebraException - if the sizes don't match.

transpose

public DenseMatrix transpose(MatrixI a)
Transpose a matrix.
Specified by:
transpose in interface AlgebraI
Throws:
AlgebraException - if the sizes don't match.

invert

public DenseMatrix invert(MatrixI a)
                   throws AlgebraException
Invert a matrix.
Specified by:
invert in interface AlgebraI
Throws:
AlgebraException - if the matrix isn't square or the inverse doesn't exist.


Copyright(C)1997-2000 by DRA Systems all rights reserved. OpsResearch.com