This is the class from which the various types of
matrices are derived. In the TMatrix class we define the
behaviour to be implemented by derived classes, and the TMatrix
class implements flags that informs, for example, if a
matrix was decomposed and the decomposition
method used (we need this information because the result of a
matrix decomposition is stored at the matrix ifself.
Every algebraic operation between matrices will return a full matrix . It is sufficient for almost all
cases and releases implementation of many particular cases.
Several submatrix operations are avaliable, such as putting a submatrix inside a matrix, copying a submatrix to a matrix and to sum matrices and submatrices. They can be used for all type of matrices, using a subclass for this purpose, the TBlock class.
Several algorithms were implemented as virtual methods. This implies that every subclass of TMatrix has a set of decomposition algorithms. In most derived classes these methods are redefined to improve efficiency.
The TFMatrix class implements Full Matrices. This class is useful for matrices that have no special property (symmetry, sparsity), or to store results of operations involving several types of matrices. See testing to have an idea of the use of TFMatrix . The TFMatrix class is the only class which has a defined storage pattern. The elements of TFMatrix are stored column - wise to increase compatibility with FORTRAN libraries and BLAS routines.
Symmetric matrix objects will store n*(n+1)/2 components when the matrix is square of order n.
The TFBMatrix class implements Banded Matrices, that are frequently used to solve small finite-difference and finite element problems. Symmetric Banded Matrices are implemented by the TSBMatrix class. See testing to have an idea of the use of TFBMatrix .
Skyline Matrices are implemented at TskylMatrix class. These matrices are symmetric and its main feature is the storage: at each column, only the elements from diagonal to the highest (lowest) row are stored:
E X A M P L E
2.3 0 2.1 0 0 2.3 2.1
0 0 2 1.1 0 is 0 2 1.1
2.1 2 10 3 1 stored 10 3 1
0 1.1 3 1 13 as: 1 13
0 0 1 13 4.2 4.2
Decomposition algorithms and iterative methods are redefined to improve efficiency. See testing for more details.
E X A M P L E [ * * * * * * * ] The blocks at the diagonal [ * * * * * * * ] determine the position of [ ] any matrix block: [ * * * * * * * ] [ * * * * * * * ] [ (0,0) (0,1) (0,2) ] [ * * * * * * * ] [ (1,0) (1,1) (1,2) ] [ ] [ (2,0) (2,1) (2,2) ] [ * * * * * * * ] [ * * * * * * * ]
There are some more situations on testing.
The TSpMatrix (TSSpMatrix) class implements Sparse (Symmetric Sparse) Matrices. Sparse matrix objects store only nonzero elements. See testing to have an idea of the use of TSpMatrix. The sparse matrix classes redefine the decomposition algorithms and iterative methods to improve efficiency.
The use of LU decomposition is demonstrated within the Full Matrices example, while Choleski and LDLt decompositions are demonstrated within the Simmetric Matrices examples.
They are demonstrated within the TMatrixSolver example (next section).
The dynanmic iterative methods ( CG, GRMES ) are implemented within the Template package, which is available on Netlib. Some minimal changes were made to their header files to improve numeric efficiency.
This is an especial class that takes care of all the process of solving a linear system:
See testing to have an idea of the use of TMatrixSolver.