Handles small size matrices like element matrices. More...
Public Member Functions | |
| LocalMatrix () | |
| Default constructor. | |
| LocalMatrix (const LocalMatrix< T_, NR_, NC_ > &m) | |
| Copy constructor. | |
| LocalMatrix (class Element *el, const class SpMatrix< T_ > &a) | |
| Constructor of a local matrix associated to element from a SpMatrix. | |
| LocalMatrix (class Element *el, const class SkMatrix< T_ > &a) | |
| Constructor of a local matrix associated to element from a SkMatrix. | |
| LocalMatrix (class Element *el, const class SkSMatrix< T_ > &a) | |
| Constructor of a local matrix associated to element from a SkSMatrix. | |
| ~LocalMatrix () | |
| Destructor. | |
| T_ & | operator() (size_t i, size_t j) |
| Operator () (Non constant version). | |
| T_ | operator() (size_t i, size_t j) const |
| Operator () (Constant version). | |
| void | Localize (class Element *el, const class SpMatrix< T_ > &a) |
| Initialize matrix as element matrix from global SpMatrix. | |
| void | Localize (class Element *el, const class SkMatrix< T_ > &a) |
| Initialize matrix as element matrix from global SkMatrix. | |
| void | Localize (class Element *el, const class SkSMatrix< T_ > &a) |
| Initialize matrix as element matrix from global SkSMatrix. | |
| LocalMatrix< T_, NR_, NC_ > & | operator= (const LocalMatrix< T_, NR_, NC_ > &m) |
| Operator =. | |
| LocalMatrix< T_, NR_, NC_ > & | operator= (const T_ &x) |
| Operator =. | |
| LocalMatrix< T_, NR_, NC_ > & | operator+= (const LocalMatrix< T_, NR_, NC_ > &m) |
| Operator +=. | |
| LocalMatrix< T_, NR_, NC_ > & | operator-= (const LocalMatrix< T_, NR_, NC_ > &m) |
| Operator -=. | |
| LocalVect< T_, NR_ > | operator* (class LocalVect< T_, NC_ > &x) |
| Operator *. | |
| LocalMatrix< T_, NR_, NC_ > & | operator+= (const T_ &x) |
| Operator +=. | |
| LocalMatrix< T_, NR_, NC_ > & | operator-= (const T_ &x) |
| Operator -=. | |
| LocalMatrix< T_, NR_, NC_ > & | operator*= (const T_ &x) |
| Operator *=. | |
| LocalMatrix< T_, NR_, NC_ > & | operator/= (const T_ &x) |
| Operator /=. | |
| void | MultAdd (const class LocalVect< T_, NC_ > &x, class LocalVect< T_, NR_ > &y) |
| Multiply matrix by vector and add result to vector. | |
| void | MultAddScal (const T_ &a, const class LocalVect< T_, NC_ > &x, class LocalVect< T_, NR_ > &y) |
| Multiply matrix by scaled vector and add result to vector. | |
| void | Mult (const class LocalVect< T_, NC_ > &x, class LocalVect< T_, NR_ > &y) |
| Multiply matrix by vector. | |
| void | Symmetrize () |
| Symmetrize matrix. | |
| int | Factor () |
| Factorize matrix. | |
| int | Solve (class LocalVect< T_, NR_ > &b) |
| Forward and backsubstitute to solve a linear system. | |
| int | FactorAndSolve (class LocalVect< T_, NR_ > &b) |
| Factorize matrix and solve linear system. | |
| void | Invert (LocalMatrix< T_, NR_, NC_ > &A) |
| Calculate inverse of matrix. | |
| T_ | getInnerProduct (const class LocalVect< T_, NC_ > &x, const class LocalVect< T_, NR_ > &y) |
| T_ * | getArray () |
| Return pointer to matrix as a C-array. | |
Detailed Description
template<class T_, size_t NR_, size_t NC_>
class OFELI::LocalMatrix< T_, NR_, NC_ >
Handles small size matrices like element matrices.
The template class LocalMatrix treats small size matrices. Typically, this class is recommended to store element and side arrays.
Internally, no dynamic storage is used.
- Template Parameters:
-
<T_> Data type (double, float, complex<double>, ...) <NR_> number of rows of matrix <NC_> number of columns of matrix
Constructor & Destructor Documentation
| LocalMatrix | ( | ) |
Default constructor.
Initialize matrix entries to zero.
| LocalMatrix | ( | class Element * | el, |
| const class SpMatrix< T_ > & | a | ||
| ) |
| LocalMatrix | ( | class Element * | el, |
| const class SkMatrix< T_ > & | a | ||
| ) |
| LocalMatrix | ( | class Element * | el, |
| const class SkSMatrix< T_ > & | a | ||
| ) |
Member Function Documentation
| T_& operator() | ( | size_t | i, |
| size_t | j | ||
| ) |
Operator () (Non constant version).
Returns entry at row i and column j.
| T_ operator() | ( | size_t | i, |
| size_t | j | ||
| ) | const |
Operator () (Constant version).
Returns entry at row i and column j.
| LocalMatrix< T_, NR_, NC_ > & operator= | ( | const LocalMatrix< T_, NR_, NC_ > & | m | ) |
Operator =.
Copy instance m into current instance.
| LocalMatrix< T_, NR_, NC_ > & operator= | ( | const T_ & | x | ) |
Operator =.
Assign x to matrix entries.
| LocalMatrix< T_, NR_, NC_ > & operator+= | ( | const LocalMatrix< T_, NR_, NC_ > & | m | ) |
Operator +=.
Add m to current matrix.
| LocalMatrix< T_, NR_, NC_ > & operator-= | ( | const LocalMatrix< T_, NR_, NC_ > & | m | ) |
Operator -=.
Subtract m from current matrix.
Operator *.
Return a Vect instance as product of current matrix by vector x.
| LocalMatrix< T_, NR_, NC_ > & operator+= | ( | const T_ & | x | ) |
Operator +=.
Add constant x to current matrix entries.
| LocalMatrix< T_, NR_, NC_ > & operator-= | ( | const T_ & | x | ) |
Operator -=.
Subtract x from current matrix entries.
| LocalMatrix< T_, NR_, NC_ > & operator*= | ( | const T_ & | x | ) |
Operator *=.
Multiply matrix entries by constant x.
| LocalMatrix< T_, NR_, NC_ > & operator/= | ( | const T_ & | x | ) |
Operator /=.
Divide by x current matrix entries.
Multiply matrix by vector and add result to vector.
- Parameters:
-
[in] x Vector to multiply matrix by. [out] y Resulting vector ( y+=a*x)
| void MultAddScal | ( | const T_ & | a, |
| const class LocalVect< T_, NC_ > & | x, | ||
| class LocalVect< T_, NR_ > & | y | ||
| ) |
Multiply matrix by scaled vector and add result to vector.
- Parameters:
-
[in] a Constant to premultiply by vector x.[in] x (Scaled) vector to multiply matrix by. [out] y Resulting vector ( y+=a*x)
Multiply matrix by vector.
- Parameters:
-
[in] x Vector to multiply matrix by. [out] y Resulting vector.
| void Symmetrize | ( | ) |
Symmetrize matrix.
Fill upper triangle to form a symmetric matrix.
| int Factor | ( | ) |
Factorize matrix.
Performs a LU factorization.
- Returns:
- 0 : Factorization has ended normally,
- n : n-th pivot was zero.
Forward and backsubstitute to solve a linear system.
- Parameters:
-
[in] b Right-hand side in input and solution vector in output.
- Returns:
- 0 : Solution was performed normally.
- n : n-th pivot is zero.
- Note:
- Matrix must have been factorized at first.
| int FactorAndSolve | ( | class LocalVect< T_, NR_ > & | b | ) |
Factorize matrix and solve linear system.
- Parameters:
-
[in,out] b Right-hand side in input and solution vector in output.
- Returns:
- 0 if solution was performed normally.
- n if
n-thpivot is zero. This function simply callsFactor()thenSolve(b).
| void Invert | ( | LocalMatrix< T_, NR_, NC_ > & | A | ) |
Calculate inverse of matrix.
- Parameters:
-
[out] A Inverse of matrix
| T_ getInnerProduct | ( | const class LocalVect< T_, NC_ > & | x, |
| const class LocalVect< T_, NR_ > & | y | ||
| ) |
Calculate inner product witrh respect to matrix. Returns the product x^T*A*y
- Parameters:
-
[in] x Left vector [in] y Right vector
- Returns:
- Resulting product
- OFELI
- LocalMatrix