To handle symmetric dense matrices. More...
Inheritance diagram for DSMatrix< T_ >:
Public Member Functions | |
| DSMatrix () | |
| Default constructor. Initializes a zero-dimension matrix. | |
| DSMatrix (size_t dim) | |
| Constructor that for a ymmetric matrix with given number of rows. Assigns 0 to all matrix entries. | |
| DSMatrix (const DSMatrix< T_ > &m) | |
| Copy Constructor. | |
| ~DSMatrix () | |
| Destructor. | |
| void | setDiag () |
| Store diagonal entries in a separate internal vector. | |
| void | Resize (size_t dim) |
| Set size (number of rows) of matrix. | |
| void | set (size_t i, size_t j, const T_ &x) |
| Assign constant to entry (i,j) of the matrix. | |
| void | Add (size_t i, size_t j, const T_ &x) |
| Add constant to an entry ofthe matrix. | |
| T_ | operator() (size_t i, size_t j) const |
| Operator () (Constant version). | |
| T_ & | operator() (size_t i, size_t j) |
| Operator () (Non constant version). | |
| DSMatrix< T_ > & | operator= (const DSMatrix< T_ > &m) |
| Operator =. Copy matrix m to current matrix instance. | |
| DSMatrix< T_ > & | operator= (const T_ &x) |
| Operator =. Assign constant value x to all matrix entries. | |
| int | Factor () |
| Factorize matrix (LDLt). | |
| void | MultAdd (const Vect< T_ > &x, Vect< T_ > &y) const |
| Multiply matrix by vector a*x and add result to y. | |
| void | MultAdd (T_ a, const Vect< T_ > &x, Vect< T_ > &y) const |
| Multiply matrix by vector a*x and add to y. | |
| void | Mult (const Vect< T_ > &x, Vect< T_ > &y) const |
| Multiply matrix by vector x and save result in y. | |
| void | TMult (const Vect< T_ > &x, Vect< T_ > &y) const |
| Multiply transpose of matrix by vector x and add result in y. | |
| void | Axpy (T_ a, const DSMatrix< T_ > &x) |
| Add to matrix the product of a matrix by a scalar. | |
| void | Axpy (T_ a, const Matrix< T_ > *x) |
| Add to matrix the product of a matrix by a scalar. | |
| int | Solve (Vect< T_ > &b) |
| Solve system with factored matrix (forward and back substitution). | |
| int | Solve (const Vect< T_ > &b, Vect< T_ > &x) |
| Solve system with factorized matrix (forward and back substitution). | |
| T_ * | getArray () const |
| Return matrix as C-Array. Matrix is stored row by row. Only lower triangle is stored. | |
| T_ | getEntry (size_t i, size_t j) const |
Return entry (i,j) of matrix. | |
| void | setPrintView (size_t rmin, size_t rmax, size_t cmin, size_t cmax) |
| Set a window for matrix printing. | |
| size_t | getNbRows () const |
| Return number of rows. | |
| size_t | getNbColumns () const |
| Return number of columns. | |
| void | setPenal (double p) |
| Set Penalty Parameter (For boundary condition prescription). | |
| void | setDiagonal () |
| Set the matrix as diagonal. | |
| void | setDiagonal (const class Mesh &mesh) |
| Initialize matrix storage in the case where only diagonal terms are stored. | |
| T_ | getDiag (size_t k) const |
| Return k-th diagonal entry of matrix. | |
| size_t | getSize () const |
| Return matrix dimension (Number of rows and columns). | |
| void | Assembly (const class Element *el, T_ *a) |
| Assembly of element matrix into global matrix. | |
| void | Assembly (const class Element *el, const DMatrix< T_ > &a) |
| Assembly of element matrix into global matrix. | |
| void | Assembly (const class Side *sd, T_ *a) |
| Assembly of side matrix into global matrix. | |
| void | Assembly (const class Side *sd, const DMatrix< T_ > &a) |
| Assembly of side matrix into global matrix. | |
| void | Prescribe (const class Mesh &mesh, Vect< T_ > &b, const Vect< T_ > &u, int flag=0) |
| Impose by a penalty method an essential boundary condition. | |
| void | Prescribe (Vect< T_ > &b, const Vect< T_ > &u, int flag=0) |
| Impose by a penalty method an essential boundary condition, using the Mesh instance provided by the constructor. | |
| void | Prescribe (const class Mesh &mesh, Vect< T_ > &b, int flag=0) |
| Impose by a penalty method a homegeneous (=0) essential boundary condition. | |
| void | Prescribe (Vect< T_ > &b, int flag=0) |
| Impose by a penalty method a homegeneous (=0) essential boundary condition, using the Mesh instance provided by the constructor. | |
| void | Prescribe (size_t dof, const class Mesh &mesh, Vect< T_ > &b, const Vect< T_ > &u, int flag=0) |
| Impose by a penalty method an essential boundary condition when only one DOF is treated. | |
| void | Prescribe (size_t dof, Vect< T_ > &b, const Vect< T_ > &u, int flag=0) |
| Impose by a penalty method an essential boundary condition when only one DOF is treated. | |
| void | PrescribeSide (const class Mesh &mesh) |
| Impose by a penalty method an essential boundary condition when DOFs are supported by sides. | |
| void | PrescribeSide () |
| Impose by a penalty method an essential boundary condition when DOFs are supported by sides. | |
| int | FactorAndSolve (Vect< T_ > &b) |
| Factorize matrix and solve the linear system. | |
| unsigned long | getLength () const |
| Return number of stored terms in matrix. | |
| bool | isDiagonal () const |
| Say if matrix is diagonal or not. | |
| bool | isFactorized () const |
| Say if matrix is factorized or not. | |
| virtual size_t | getColInd (size_t i) const |
| Return Column index for column i (See the description for class SpMatrix). | |
| virtual size_t | getRowPtr (size_t i) const |
| Return Row pointer for row i (See the description for class SpMatrix). | |
| T_ | operator() (size_t i) const |
| Operator () with one argument (Constant version). | |
| T_ & | operator() (size_t i) |
| Operator () with one argument (Non Constant version). | |
| T_ & | operator[] (size_t k) |
| Operator [] (Non constant version). | |
| T_ | operator[] (size_t k) const |
| Operator [] (Constant version). | |
| Matrix & | operator+= (const Matrix< T_ > &m) |
| Operator +=. | |
| Matrix & | operator+= (const T_ &x) |
| Operator +=. | |
| Matrix & | operator-= (const Matrix< T_ > &m) |
| Operator -=. | |
| Matrix & | operator-= (const T_ &x) |
| Operator -=. | |
| Matrix & | operator*= (const T_ &x) |
| Operator *=. | |
| void | getPrintView (size_t &rmin, size_t &rmax, size_t &cmin, size_t &cmax) const |
| Return window data for matrix printing. | |
Detailed Description
template<class T_>
class OFELI::DSMatrix< T_ >
To handle symmetric dense matrices.
This class enables storing and manipulating symmetric dense matrices.
- Template Parameters:
-
<T_> Data type (double, float, complex<double>, ...)
Constructor & Destructor Documentation
| DSMatrix | ( | size_t | dim | ) |
Constructor that for a ymmetric matrix with given number of rows. Assigns 0 to all matrix entries.
- Parameters:
-
[in] dim Number of rows
Member Function Documentation
| void Resize | ( | size_t | dim | ) |
Set size (number of rows) of matrix.
- Parameters:
-
[in] dim Number of rows and columns.
| void set | ( | size_t | i, |
| size_t | j, | ||
| const T_ & | x | ||
| ) | [virtual] |
Assign constant to entry (i,j) of the matrix.
- Parameters:
-
[in] i row index [in] j column index [in] x value to assign to a(i,j)
Implements Matrix< T_ >.
| void Add | ( | size_t | i, |
| size_t | j, | ||
| const T_ & | x | ||
| ) | [virtual] |
Add constant to an entry ofthe matrix.
- Parameters:
-
[in] i row index [in] j column index [in] x value to add to a(i,j)
Implements Matrix< T_ >.
| T_ operator() | ( | size_t | i, |
| size_t | j | ||
| ) | const [virtual] |
Operator () (Constant version).
- Parameters:
-
[in] i Row index [in] j Column index
Implements Matrix< T_ >.
| T_ & operator() | ( | size_t | i, |
| size_t | j | ||
| ) | [virtual] |
Operator () (Non constant version).
- Parameters:
-
[in] i Row index [in] j Column index
Implements Matrix< T_ >.
| int Factor | ( | ) | [virtual] |
Factorize matrix (LDLt).
- Returns:
- 0, if factorization was normally performed,
- n, if the n-th pivot is null.
Implements Matrix< T_ >.
Multiply matrix by vector a*x and add to y.
- Parameters:
-
[in] a Constant to multiply by matrix [in] x Vector to multiply by matrix [in,out] y Vector to add to the result. y contains on output the result.
Implements Matrix< T_ >.
Multiply transpose of matrix by vector x and add result in y.
- Parameters:
-
[in] x Vector to add to y [in,out] y on input, vector to add to. On output, result.
Implements Matrix< T_ >.
Add to matrix the product of a matrix by a scalar.
- Parameters:
-
[in] a Scalar to premultiply [in] x Matrix by which a is multiplied. The result is added to current instance
Add to matrix the product of a matrix by a scalar.
- Parameters:
-
[in] a Scalar to premultiply [in] x Matrix by which a is multiplied. The result is added to current instance
Implements Matrix< T_ >.
Solve system with factored matrix (forward and back substitution).
- Parameters:
-
[in] b Vect instance that contains right-hand side on input and solution on output.
- Returns:
- 0, if solution was normally performed,
- n, if the n-th pivot is null. Solution is performed only if factorization has previouly been invoked.
Implements Matrix< T_ >.
Solve system with factorized matrix (forward and back substitution).
- Parameters:
-
[in] b Vect instance that contains right-hand side [in] x Vect instance that contains solution
- Returns:
- 0, if solution was normally performed,
- n, if the n-th pivot is null. Solution is performed only if factorization has previouly been invoked.
Reimplemented from Matrix< T_ >.
| void setPrintView | ( | size_t | rmin, |
| size_t | rmax, | ||
| size_t | cmin, | ||
| size_t | cmax | ||
| ) |
Set a window for matrix printing.
- Parameters:
-
[in] rmin first row index to view [in] rmax last row index to view [in] cmin first column index to view [in] cmax last column index to view
Reimplemented from Matrix< T_ >.
| void setDiagonal | ( | const class Mesh & | mesh | ) | [inherited] |
Initialize matrix storage in the case where only diagonal terms are stored.
This member function is to be used for explicit time integration schemes
| T_ getDiag | ( | size_t | k | ) | const [inherited] |
Return k-th diagonal entry of matrix.
First entry is given by getDiag(1).
Assembly of element matrix into global matrix.
Case where element matrix is given by a C-array.
- Parameters:
-
[in] el Pointer to element instance [in] a Element matrix as a C-array
Assembly of side matrix into global matrix.
Case where side matrix is given by a C-array.
- Parameters:
-
[in] sd Pointer to side instance [in] a Side matrix as a C-array instance
| void Prescribe | ( | const class Mesh & | mesh, |
| Vect< T_ > & | b, | ||
| const Vect< T_ > & | u, | ||
| int | flag = 0 |
||
| ) | [inherited] |
Impose by a penalty method an essential boundary condition.
This member function modifies diagonal terms in matrix and terms in vector that correspond to degrees of freedom with nonzero code in order to impose a boundary condition. The penalty parameter is defined by default equal to 1.e20. It can be modified by member function setPenal(..).
- Parameters:
-
[in] mesh Mesh instance from which information is extracted. [in,out] b Vect instance that contains right-hand side. [in] u Vect instance that conatins imposed valued at DOFs where they are to be imposed. [in] flag Parameter to determine whether only the right-hand side is to be modified
(dof>0) or both matrix and right-hand side (dof=0, default value).
Impose by a penalty method an essential boundary condition, using the Mesh instance provided by the constructor.
This member function modifies diagonal terms in matrix and terms in vector that correspond to degrees of freedom with nonzero code in order to impose a boundary condition. The penalty parameter is defined by default equal to 1.e20. It can be modified by member function setPenal(..).
- Parameters:
-
[in,out] b Vect instance that contains right-hand side. [in] u Vect instance that conatins imposed valued at DOFs where they are to be imposed. [in] flag Parameter to determine whether only the right-hand side is to be modified (dof>0)
or both matrix and right-hand side (dof=0, default value).
Impose by a penalty method a homegeneous (=0) essential boundary condition.
This member function modifies diagonal terms in matrix and terms in vector that correspond to degrees of freedom with nonzero code in order to impose a boundary condition. The penalty parameter is defined by default equal to 1.e20. It can be modified by member function setPenal(..).
Impose by a penalty method a homegeneous (=0) essential boundary condition, using the Mesh instance provided by the constructor.
This member function modifies diagonal terms in matrix and terms in vector that correspond to degrees of freedom with nonzero code in order to impose a boundary condition. The penalty parameter is defined by default equal to 1.e20. It can be modified by member function setPenal(..).
- Parameters:
-
[in,out] b Vect instance that contains right-hand side. [in] flag Parameter to determine whether only the right-hand side is to be modified (dof>0)
or both matrix and right-hand side (dof=0, default value).
| void Prescribe | ( | size_t | dof, |
| const class Mesh & | mesh, | ||
| Vect< T_ > & | b, | ||
| const Vect< T_ > & | u, | ||
| int | flag = 0 |
||
| ) | [inherited] |
Impose by a penalty method an essential boundary condition when only one DOF is treated.
This member function modifies diagonal terms in matrix and terms in vector that correspond to degrees of freedom with nonzero code in order to impose a boundary condition. This gunction is to be used if only one DOF per node is treated in the linear system. The penalty parameter is by default equal to 1.e20. It can be modified by member function setPenal.
- Parameters:
-
[in] dof Label of the concerned degree of freedom (DOF). [in] mesh Mesh instance from which information is extracted. [in,out] b Vect instance that contains right-hand side. [in] u Vect instance that conatins imposed valued at DOFs where they are to be imposed. [in] flag Parameter to determine whether only the right-hand side is to be modified (dof>0)
or both matrix and right-hand side (dof=0, default value).
Impose by a penalty method an essential boundary condition when only one DOF is treated.
This member function uses the Mesh instance provided by the constructor.
It modifies diagonal terms in matrix and terms in vector that correspond to degrees of freedom with nonzero code in order to impose a boundary condition. This gunction is to be used if only one DOF per node is treated in the linear system. The penalty parameter is by default equal to 1.e20. It can be modified by member function setPenal.
- Parameters:
-
[in] dof Label of the concerned degree of freedom (DOF). [in,out] b Vect instance that contains right-hand side. [in] u Vect instance that conatins imposed valued at DOFs where they are to be imposed. [in] flag Parameter to determine whether only the right-hand side is to be modified (dof>0)
or both matrix and right-hand side (dof=0, default value).
| void PrescribeSide | ( | const class Mesh & | mesh | ) | [inherited] |
Impose by a penalty method an essential boundary condition when DOFs are supported by sides.
This member function uses the Mesh instance provided by the constructor
It modifies diagonal terms in matrix and terms in vector that correspond to degrees of freedom with nonzero code in order to impose a boundary condition. The penalty parameter is defined by default equal to 1.e20. It can be modified by member function setPenal(..).
| void PrescribeSide | ( | ) | [inherited] |
Impose by a penalty method an essential boundary condition when DOFs are supported by sides.
This member function modifies diagonal terms in matrix and terms in vector that correspond to degrees of freedom with nonzero code in order to impose a boundary condition. The penalty parameter is defined by default equal to 1.e20. It can be modified by member function setPenal(..).
| int FactorAndSolve | ( | Vect< T_ > & | b | ) | [inherited] |
Factorize matrix and solve the linear system.
This is available only if the storage class enables it.
| bool isFactorized | ( | ) | const [inherited] |
Say if matrix is factorized or not.
If the matrix was not factorized, the class does not allow solving by a direct solver.
| T_ operator() | ( | size_t | i | ) | const [inherited] |
Operator () with one argument (Constant version).
Returns i-th position in the array storing matrix entries. The first entry is at location 1. Entries are stored row by row.
- Parameters:
-
[in] i entry index
Reimplemented in SpMatrix< T_ >.
| T_& operator() | ( | size_t | i | ) | [inherited] |
Operator () with one argument (Non Constant version).
Returns i-th position in the array storing matrix entries. The first entry is at location 1. Entries are stored row by row.
- Parameters:
-
[in] i entry index
| T_& operator[] | ( | size_t | k | ) | [inherited] |
Operator [] (Non constant version).
Returns k-th stored element in matrix Index k starts at 0.
| T_ operator[] | ( | size_t | k | ) | const [inherited] |
Operator [] (Constant version).
Returns k-th stored element in matrix Index k starts at 0.
Reimplemented in SpMatrix< T_ >.
Operator +=.
Add matrix m to current matrix instance.
| Matrix< T_ > & operator+= | ( | const T_ & | x | ) | [inherited] |
Operator +=.
Add constant value x to all matrix entries.
Reimplemented in SkMatrix< T_ >, DMatrix< T_ >, and BMatrix< T_ >.
Operator -=.
Subtract matrix m from current matrix instance.
| Matrix< T_ > & operator-= | ( | const T_ & | x | ) | [inherited] |
| Matrix< T_ > & operator*= | ( | const T_ & | x | ) | [inherited] |
Operator *=.
Premultiply matrix entries by constant value x.
Reimplemented in SkMatrix< T_ >, SkSMatrix< T_ >, DMatrix< T_ >, BMatrix< T_ >, and TrMatrix< T_ >.
| void getPrintView | ( | size_t & | rmin, |
| size_t & | rmax, | ||
| size_t & | cmin, | ||
| size_t & | cmax | ||
| ) | const [inherited] |
Return window data for matrix printing.
- Parameters:
-
[out] rmin first row index to view [out] rmax last row index to view [out] cmin first column index to view [out] cmax last column index to view
- OFELI
- DSMatrix