|
IFEM
90A354
|
Common base class for multi-dimensional (2D and 3D) matrices. More...
#include <matrix.h>

Public Member Functions | |
| size_t | dim (short int d=1) const |
| Query dimensions. | |
| size_t | size () const |
| Query total matrix size. | |
| bool | empty () const |
| Check if the matrix is empty. | |
| bool | zero (T tol=T(0)) const |
| Check if the matrix elements are all zero. | |
| const vector< T > & | toVec () const |
| Type casting to a one-dimensional utl::vector, for access. | |
| operator const std::vector< T > & () const | |
| Type casting to a one-dimensional std::vector, for access. | |
| operator std::vector< T > & () | |
| Type casting to a one-dimensional vector, for update. | |
| T * | ptr (size_t c=0) |
| Access through pointer. | |
| const T * | ptr (size_t c=0) const |
| Reference through pointer. | |
| std::vector< T >::iterator | begin () |
| Iterator to the start of the matrix elements. | |
| std::vector< T >::iterator | end () |
| Iterator to the end of the matrix elements. | |
| void | clear () |
| Clears the matrix and sets its dimension to zero. | |
| void | fill (T s) |
| Fill the matrix with a scalar value. | |
| void | fill (const T *values, size_t n=0) |
| Fill the matrix with data from an array. | |
| matrixBase< T > & | add (const matrixBase< T > &A, const T &alfa) |
| Add the given matrix A scaled by alfa to *this. | |
| matrixBase< T > & | multiply (const T &c) |
| Multiplication of this matrix by a scalar c. | |
| T | norm2 (int inc=1) const |
| Return the Euclidean norm of the matrix. More... | |
| T | asum (int inc=1) const |
| Return the sum of the absolute value of the matrix elements. More... | |
| T | sum (int inc=1) const |
| Return the sum of the matrix elements. More... | |
Protected Member Functions | |
| matrixBase () | |
| The constructor is protected to allow sub-class instances only. | |
| matrixBase (vector< T > &vec) | |
| Constructor using an external vector for matrix element storage. | |
| matrixBase (size_t n_1, size_t n_2, size_t n_3=1, size_t n_4=1) | |
| Constructor creating a matrix of dimension \(n_1 \times n_2 \times n_3 \times n_4\). | |
| matrixBase (const matrixBase< T > &mat, bool copyContent=true) | |
| Copy constructor. More... | |
| void | redim (size_t n_1, size_t n_2, size_t n_3, size_t n_4, bool forceClear) |
| Resize the matrix to dimension \(n_1 \times n_2 \times n_3 \times n_4\). More... | |
| virtual void | clearIfNrowChanged (size_t n1, size_t n2, size_t n3)=0 |
| Clears the matrix content if the first dimension(s) changed. | |
Protected Attributes | |
| size_t | n [4] |
| Dimension of the matrix. | |
| vector< T > & | elem |
| Actual matrix elements, stored column by column. | |
Private Attributes | |
| vector< T > | myElem |
| Internal matrix storage. | |
Common base class for multi-dimensional (2D and 3D) matrices.
Contains the methods that the 2D and 3D matrices have in common.
|
inlineprotected |
Copy constructor.
| [in] | mat | The matrix to copy |
| [in] | copyContent | If false, only copy the matrix dimension |
References utl::matrixBase< T >::elem, and utl::matrixBase< T >::n.
|
inline |
Return the sum of the absolute value of the matrix elements.
| [in] | inc | Increment in the matrix element vector indices |
References utl::matrixBase< T >::elem.
|
inline |
Return the Euclidean norm of the matrix.
| [in] | inc | Increment in the matrix element vector indices |
References utl::matrixBase< T >::elem.
Referenced by StabilizationUtils::getTauPt().
|
inlineprotected |
Resize the matrix to dimension \(n_1 \times n_2 \times n_3 \times n_4\).
Will erase the previous content, but only if both the total matrix size, and any of its dimensions except the last are changed. It is therefore possible to add or remove a given number of elements in the last dimension of the matrix without loosing the contents of the other dimensions. If forceClear is true, the old matrix content is always erased.
References utl::matrixBase< T >::clear(), utl::matrixBase< T >::clearIfNrowChanged(), utl::matrixBase< T >::elem, utl::matrixBase< T >::fill(), utl::matrixBase< T >::n, utl::RETAIN, and utl::matrixBase< T >::size().
Referenced by utl::matrix3d< T >::resize(), utl::matrix4d< T >::resize(), and utl::matrix< T >::resize().
|
inline |
Return the sum of the matrix elements.
| [in] | inc | Increment in the matrix element vector indices. If negative, the sum of matrix column -inc will be returned instead. |
References utl::matrixBase< T >::elem, and utl::matrixBase< T >::n.
Referenced by ASMu2D::evaluateBasisNurbs().