Handles small size matrices like element matrices, with a priori known size. More...
Public Member Functions | |
| LocalMatrix () | |
| Default constructor. More... | |
| LocalMatrix (const LocalMatrix< T_, NR_, NC_ > &m) | |
| Copy constructor. | |
| LocalMatrix (Element *el, const SpMatrix< T_ > &a) | |
| Constructor of a local matrix associated to element from a SpMatrix. More... | |
| LocalMatrix (Element *el, const SkMatrix< T_ > &a) | |
| Constructor of a local matrix associated to element from a SkMatrix. More... | |
| LocalMatrix (Element *el, const SkSMatrix< T_ > &a) | |
| Constructor of a local matrix associated to element from a SkSMatrix. More... | |
| ~LocalMatrix () | |
| Destructor. | |
| T_ & | operator() (size_t i, size_t j) |
Operator () (Non constant version) More... | |
| T_ | operator() (size_t i, size_t j) const |
Operator () (Constant version) More... | |
| void | Localize (Element *el, const SpMatrix< T_ > &a) |
| Initialize matrix as element matrix from global SpMatrix. More... | |
| void | Localize (Element *el, const SkMatrix< T_ > &a) |
| Initialize matrix as element matrix from global SkMatrix. More... | |
| void | Localize (Element *el, const SkSMatrix< T_ > &a) |
| Initialize matrix as element matrix from global SkSMatrix. More... | |
| LocalMatrix< T_, NR_, NC_ > & | operator= (const LocalMatrix< T_, NR_, NC_ > &m) |
Operator = More... | |
| LocalMatrix< T_, NR_, NC_ > & | operator= (const T_ &x) |
Operator = More... | |
| LocalMatrix< T_, NR_, NC_ > & | operator+= (const LocalMatrix< T_, NR_, NC_ > &m) |
Operator += More... | |
| LocalMatrix< T_, NR_, NC_ > & | operator-= (const LocalMatrix< T_, NR_, NC_ > &m) |
Operator -= More... | |
| LocalVect< T_, NR_ > | operator* (LocalVect< T_, NC_ > &x) |
Operator * More... | |
| LocalMatrix< T_, NR_, NC_ > & | operator+= (const T_ &x) |
Operator += More... | |
| LocalMatrix< T_, NR_, NC_ > & | operator-= (const T_ &x) |
Operator -= More... | |
| LocalMatrix< T_, NR_, NC_ > & | operator*= (const T_ &x) |
Operator *= More... | |
| LocalMatrix< T_, NR_, NC_ > & | operator/= (const T_ &x) |
Operator /= More... | |
| void | MultAdd (const LocalVect< T_, NC_ > &x, LocalVect< T_, NR_ > &y) |
| Multiply matrix by vector and add result to vector. More... | |
| void | MultAddScal (const T_ &a, const LocalVect< T_, NC_ > &x, LocalVect< T_, NR_ > &y) |
| Multiply matrix by scaled vector and add result to vector. More... | |
| void | Mult (const LocalVect< T_, NC_ > &x, LocalVect< T_, NR_ > &y) |
| Multiply matrix by vector. More... | |
| void | Symmetrize () |
| Symmetrize matrix. More... | |
| int | Factor () |
| Factorize matrix. More... | |
| int | solve (LocalVect< T_, NR_ > &b) |
| Forward and backsubstitute to solve a linear system. More... | |
| int | FactorAndSolve (LocalVect< T_, NR_ > &b) |
| Factorize matrix and solve linear system. More... | |
| void | Invert (LocalMatrix< T_, NR_, NC_ > &A) |
| Calculate inverse of matrix. More... | |
| T_ | getInnerProduct (const LocalVect< T_, NC_ > &x, const LocalVect< T_, NR_ > &y) |
| Calculate inner product witrh respect to matrix. More... | |
| T_ * | get () |
| 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, with a priori known size.
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
- Author
- Rachid Touzani
- Copyright
- GNU Lesser Public License
Constructor & Destructor Documentation
| LocalMatrix | ( | ) |
Default constructor.
Constructs a matrix with 0 rows and 0 columns
| LocalMatrix | ( | Element * | el, |
| const SpMatrix< T_ > & | a | ||
| ) |
| LocalMatrix | ( | Element * | el, |
| const SkMatrix< T_ > & | a | ||
| ) |
| LocalMatrix | ( | Element * | el, |
| const 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 matrix to identity times x
| 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)
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.
-
| int solve | ( | LocalVect< T_, NR_ > & | b | ) |
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 | ( | 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
0if solution was performed normally.nifn-th pivot is zero. This function simply calls Factor() then Solve(b).
| void Invert | ( | LocalMatrix< T_, NR_, NC_ > & | A | ) |
Calculate inverse of matrix.
- Parameters
-
[out] A Inverse of matrix