Package ru.sscc.matrix

Collection of classes describing algebraic matrices.

See:
          Description

Interface Summary
Matrix An abstract matrix interface describes dimensions functions usefull for any matrix.
RealAlgebraicMatrix An algebraic matrix interface describes matrix by vector multiplication methods.
 

Class Summary
DenseMatrix An implementation of a rectangular dense matrix.
RealMatrix An abstract implementation of a real rectangular algebraic matrix based on RealContainer entries vector.
RectBandedMatrix Performs operations upon a Rectangular Banded Matrix.
SymBandedMatrix Performs operations upon a Symmetric Banded Matrix.
TransposedMatrix The decorator class treating an algebraic matrix as the transposed matrix.
 

Package ru.sscc.matrix Description

Collection of classes describing algebraic matrices.

Basic interfaces and classes

The Matrix interface describes the most common properties of any matrix: a matrix is a rectangular table consisting of a constant number of rows and columns and a matrix is serializable object.

The RealAlgebraicMatrix interface extends the Matrix by adding two algebraic methods: the multiply(source,target) method does the multiplication of the matrix by a vector and the multiplyT(source,target) method does the multiplication of the transposed matrix by a vector. In addition, the relativeAccuracy() method must return the relative accuracy of data type used for matrix entries.

The TransposedMatrix class is the decorator class. It is used if you need to "transpose" an algebraic matrix. This is the logical transposing. It logically interchanges the columns and rows numbers and treats the matrix-by-vector multiplication as the transposed multiplication for the underlying matrix. Conversely, the multiplication of the transposed matrix by a vector is treated as the direct multiplication for the underlying matrix.

The RealMatrix abstract class is the root class for almost all real matrices. It partially implements the RealAlgebraicMatrix interface and adds four abstract methods for access to matrix values, get(i,j), set(i,j,value), add(i,j,value), and mul(i,j,value). All matrix entries are indexed from zero, e.g. the entries of m×n matrix are indexed from (0,0) to (m-1,n-1).

The entries of a real matrix are stored in the matrix body - an instance of the RealContainer type. To get the body, use the getContainer() method. The access to the matrix dimensions may be done in two way:

The lock() method blocks the use of algebraic operations upon the matrix. The locking is used when a matrix is factorized for solving linear algebraic systems with it.

The RealMatrix class package supports matrix-by-matrix multiplication operations as static methods:

multiplyNN(A,B,C)
is the multiplication of two "normal" matrices: C = AB;

multiplyTN(A,B,C)
is the multiplication of transposed and "normal" matrices: C = ATB;

multiplyNT(A,B,C)
is the multiplication of "normal" and transposed matrices: C = ABT;

multiplyTT(A,B,C)
is the multiplication of two transposed matrices: C = ATBT.

All these operations are optimized to recognize in parameters the dense matrices. They store the result in a rectangular dense matrix C and return it. If C=null, the requested matrix will be created.

The RealMatrix class supports cloning. The clone is the matrix having the separate body copied from the body of the original matrix. The clone is the algebraic matrix, independently to the state of the original matrix. If the original matrix is a submatrix of a dense matrix, the clone will contain the submatrix entries only.

Collection of Matrices

The DenseMatrix class describes a rectangular dense matrix, e.g. all matrix entries are stored in the body and can be modified. This class supports additional algebraic operations on matrices: matrix assignment and creation of the transposed matrix upon the same body. The creation of a submatrix sharing their entries with the parent matrix is also possible.

The SymBandedMatrix class describes a square symmetric banded matrix, e.g. the symmetric matrix having non-zero values along the main diagonal and a number of neighbour diagonals. The public final halfWidth attribute is equal to the number of non-zero upper diagonals plus 1. The main diagonal and upper non-zero diagonals are only stored in the matrix container. The special case of this matrix-the Toeplitz matrix is also implemented by the classes. The Toeplitz matrix has identical values along diagonals. So, to store the Toeplitz matrix, only the halfWidth entries are needed.

The RectBandedMatrix class supports a special rectangular banded matrix. The Toeplitz rectangular banded matrices are also supported.

All these classes have the reuse method, that allows to use a matrix as the algebraic matrix, e.g. to permit matrix algebraic operations.