#include <LinEqMatrix.h>
Inheritance diagram for LinEqMatrix::

Public Methods | |
| LinEqMatrix () | |
| LinEqMatrix (int nblockrows, int nblockcolumns) | |
| LinEqMatrix (const LinEqMatrix &M) | |
| LinEqMatrix (Matrix(NUMT) &mat) | |
| ~LinEqMatrix () | |
| void | size (int &nblockrows, int &nblockcolumns) const |
| int | getNoRows () const |
| int | getNoColumns () const |
| bool | redim (int nblockrows=1, int nblockcolumns=1) |
| bool | redim (const LinEqMatrix_prm &matprm) |
| bool | redim (const LinEqMatrix &M) |
| void | optimizeDataStructure () |
| int | getWork (const MatrixWork work_tp=MATVEC_WORK) const |
| real | getStorage () const |
| bool | ok () const |
| bool | single () const |
| TransposeMode | transposeMode (int i=1, int j=1) const |
| Matrix(NUMT)& | mat (int i=1, int j=1) |
| const Matrix(NUMT)& | mat (int i=1, int j=1) const |
| void | attach (const Matrix(NUMT) &mat, int i=1, int j=1, TransposeMode tpmode=NOT_TRANSPOSED) |
| LinEqMatrix& | operator= (const LinEqMatrix &M) |
| LinEqMatrix& | operator= (NUMT a) |
| void | assemble (const Mat(NUMT) &em, const VecSimple(int) &idx_row_trans, const VecSimple(int) &idx_col_trans, int elm_no, int i=1, int j=1) |
| void | assemble (const Mat(NUMT) &em, const VecSimple(int) &idx_trans, int elm_no, int i=1, int j=1) |
| bool | blockCompatible (const LinEqVector &x, const LinEqVector &b, TransposeMode tpmode=NOT_TRANSPOSED) const |
| void | prod (const LinEqVector &x, LinEqVector &y, TransposeMode tpmode=NOT_TRANSPOSED, bool add_to_yb=false) const |
| void | resetFact () |
| bool | factorize (const FactStrategy &fstrategy) |
| void | forwBack (LinEqVector &b, LinEqVector &x) |
| void | SSOR1it (LinEqVector &xnew, const LinEqVector &xold, const LinEqVector &b, real omega, TransposeMode tpmode=NOT_TRANSPOSED) const |
| void | SSORsolve (LinEqVector &y, const LinEqVector &c, real omega, TransposeMode tpmode=NOT_TRANSPOSED) const |
| void | SOR1it (LinEqVector &xnew, const LinEqVector &xold, const LinEqVector &b, real omega, TransposeMode tpmode=NOT_TRANSPOSED) const |
| void | SORsolve (LinEqVector &y, const LinEqVector &c, real omega, TransposeMode tpmode=NOT_TRANSPOSED) const |
| void | Jacobi1it (LinEqVector &xnew, const LinEqVector &xold, const LinEqVector &b, TransposeMode tpmode=NOT_TRANSPOSED) const |
| void | Jacobisolve (LinEqVector &y, const LinEqVector &c, TransposeMode tpmode=NOT_TRANSPOSED) const |
| const MatDense(NUMT)& | getMatDense (int i=1, int j=1) const |
| MatDense(NUMT)& | getMatDense (int i=1, int j=1) |
| const MatBand(NUMT)& | getMatBand (int i=1, int j=1) const |
| MatBand(NUMT)& | getMatBand (int i=1, int j=1) |
| const MatDiag(NUMT)& | getMatDiag (int i=1, int j=1) const |
| MatDiag(NUMT)& | getMatDiag (int i=1, int j=1) |
| const MatTri(NUMT)& | getMatTri (int i=1, int j=1) const |
| MatTri(NUMT)& | getMatTri (int i=1, int j=1) |
| const MatStructSparse(NUMT)& | getMatStructSparse (int i=1, int j=1) const |
| MatStructSparse(NUMT)& | getMatStructSparse (int i=1, int j=1) |
| const MatSparse(NUMT)& | getMatSparse (int i=1, int j=1) const |
| MatSparse(NUMT)& | getMatSparse (int i=1, int j=1) |
| void | debugPrint (Os os, const char *header) const |
Friends | |
| Os& | operator<< (Os &os, const LinEqMatrix &m) |
NAME: LinEqMatrix - coefficient matrix in a system of linear equations
DESCRIPTION:
The class implements a (block) matrix and constitutes the basic matrix class to be used by (iterative) equation solvers in the "LinEqSolver" hierarchy. Most operations are simplified if there is only one block present.
The class allocates a matrix of "HandleT(Matrix(NUMT)" instances, where each matrix represents a block.
Sometimes it is desired to trace the life of big matrix and vector objects. The class "LinEqMatrix" and "LinEqVector" have functionality for this. If the user gives the command line argument "+traceLinEqMb 4.2", all matrices and vectors that are larger than 4.2 Mb (storage as determined by "Matrix getStorage") will be traced. More precisely, the "HandleId traceMe" function in the matrix or vector will be called every time a matrix is created or redimensioned, with an argument (name for "traceMe") that reflects the current size of the matrix. This feature is only active if the preprocessor variable "SAFETY_CHECKS" is defined (that is the case if the program is compiled with "MODE=nopt"). Using the trace functionality, one can follow the life of large matrix and vector objects, managed by "LinEqMatrix" or "LinEqVector" instances, to get more insight into the memory requirements of an application.
|
|
There are four constructors. One is empty and allocates no internal data structure. Further initialization is then required: either a call to the "redim" function with two "int"s (the numbers of blocks) as arguments and then calls to "attach", or a call to "redim(LinEqMatrix_prm)". In the latter case, the "redim" function allocates memory for all the matrices according to the sizes given in the parameter object of class "LinEqMatrix_prm". Another alternative is to call "redim(LinEqMatrix)", where the allocation is based on an already existing "LinEqMatrix" structure. Note that the "redim" function that takes two "int"s as arguments allocates an internal matrix of handles. These handles are empty and must be rebound to objects of type "Matrix(NUMT)" by calling the "attach" function. The other "redim" functions allocate both the matrix of handles and "Matrix(NUMT)" objects that are rebound to the handles. To ensure correct behaviour of a "LinEqMatrix" object no handles are allowed to be empty. In addition to the default constructor, there are other constructors accepting the number of blocks, a preallocated "LinEqmatrix" object or a "Matrix(NUMT)" object. In the first of these cases, attachment or some redimensioning of each block is required. The third option implies that the "LinEqMatrix" object consists of a single block. Deallocation of everything that is allocated in "LinEqMatrix" objects will automatically take place when the "LinEqMatrix" object goes out of scope since then all handles will be deleted and the handles will delete the "Matrix(NUMT)" objects if there are no other handle to these objects. Further initialization of the class is not necessary, except that the matrices must be filled by proper "NUMT" values. |
|
|
|
|
|
See documentation of one of the overloaded constructor. |
|
|
See documentation of one of the overloaded constructor. |
|
|
|
|
|
as "SSOR1it", but is related to the Jacobi iteration. |
|
|
as "SSOR1solve", but is related to the Jacobi (diagonal) splitting. |
|
|
as "SSOR1it", but is related to the SOR iteration. |
|
|
as "SSOR1solve", but is related to the SOR splitting. |
|
|
performs one single iteration of SSOR on the system "Ax=b" where "A" refers to the current matrix object (and on "tpmode"). The parameters "xnew" and "xold" denote the previous and next iterates, respectively. |
|
|
solves the system "My=c", where "M" denotes the SSOR splitting matrix based on the current matrix object (and on "tpmode"). |
|
|
See documentation of one of the overloaded functions. |
|
|
adds a small matrix to a large, global matrix. The elements are assembled according to index transformation vectors. The routine is useful when programming finite element methods. See class "Mat" or "Matrix" for more details (the present function is just a simple call to the similar functions in the matrix classes). |
|
|
attach a "Matrix(NUMT)" handle as block. |
|
|
compares the block size of its arguments "x" and "b" with the current matrix "A" to see that "Ax=b"` is possible with respect to blocking. If "tpmode" signifies the use of the transposed matrix or the conjugate transposed matrix, this check corresponds to "A^Tx=b" or "A^Hx=b"`, respectively. |
|
|
prints the contents of a "LinEqMatrix" object block for block. Alternatively, printing can be done by calls like "v.mat(i,j).print(os)". |
|
|
computes a factorization of the matrix determined by the current "FactStrategy" parameter. The factorization overwrites the matrix entries. In case of pivoting, extra storage will be allocated and managed internally. The function returns a false value if the factorization failed. By its nature, due to the propagation of fill-in entries, matrix factorization is available only for single block storage. |
|
|
a general interface to forward and backward substitution routines. Depending on the previously selected factorization type, the appropriate action is taken. |
|
|
See documentation of one of the overloaded functions. |
|
|
get a reference to a "MatBand" matrix (for a specified block, default block is (1,1)), the function involves casting of a "Matrix(NUMT)" pointer to a "MatBand(NUMT)" pointer. Note that use of the "getMat*" functions requires the programmer to know the matrix type at compile-time. Do not use this routine to index a matrix, declare your own reference and use this routine to initialize that reference. |
|
|
See documentation of one of the overloaded functions. |
|
|
as "getMatBand", but a "MatDense" reference is returned. |
|
|
See documentation of one of the overloaded functions. |
|
|
as "getMatBand", but a "MatDiag" reference is returned. |
|
|
See documentation of one of the overloaded functions. |
|
|
as "getMatBand", but a "MatSparse" reference is returned. |
|
|
See documentation of one of the overloaded functions. |
|
|
as "getMatBand", but a "MatStructSparse" reference is returned. |
|
|
See documentation of one of the overloaded functions. |
|
|
as "getMatBand", but a "MatTri" reference is returned. |
|
|
returns the total number of columns (added up over all blocks). |
|
|
returns the total number of rows (added up over all blocks). |
|
|
returns the total storage cost (added up over all blocks). |
|
|
returns the total cost if the last issued matrix operation (added up over all blocks). |
|
|
See documentation of one of the overloaded functions. |
|
|
subscripting, returns a "Matrix(NUMT)" reference to a block. There are two such functions, one for read and one for write operations. |
|
|
returns "true" if the object is in an ok state. The value "false" is returned only if there are empty handles. |
|
|
See documentation of one of the overloaded functions. |
|
|
redimensions and initializes this "LinEqMatrix" object based on another existing "LinEqMatrix". |
|
|
calls "optimizeDataStructure" for each sub-block, resulting in tuning of the internal representations of the matrix blocks, e.g.\ by reducing the storage of zero entries in a sparse matrix pattern. |
|
|
calculates the product of two matrices or a matrix and a vector, depending on the arguments of the function. The return type is void. Hence the result is available as one of the arguments to "prod". This gives the user of the function total control of the memory allocation associated with the result array. An "enum" "TransposeMode" can be given as argument in order to indicate whether the matrix itself, its transposed, or its conjugate transposed should be used in the product. A "bool" can be used to indicate, that the product should be added instead of overwritten. |
|
|
See documentation of one of the overloaded functions. |
|
|
See documentation of one of the overloaded functions. |
|
|
redimension the block matrix. If given a "LinEqMatrix_prm" or "LinEqmatrix" object, each block is also redimensioned according to indicated block sizes and formats. |
|
|
flags the matrix as not factorized. This function must be called if the same matrix object is reused for new data after a factorization, otherwise it is impossible to factorize the new matrix. |
|
|
returns "true" if there is only a single block. |
|
|
returns the number of blocks. |
|
|
returns a "TransposeMode" value indicating whether the specified block is to be treated as it is, as transposed or conjugate transposed. |
|
|
see "debugPrint". |