|
IFEM
90A354
|
Three-dimensional rectangular matrix with some algebraic operations. More...
#include <matrixnd.h>


Public Member Functions | |
| matrix3d () | |
| Constructor creating an empty matrix. | |
| matrix3d (vector< T > &vec) | |
| Constructor using an external vector for matrix element storage. | |
| matrix3d (size_t n_1, size_t n_2, size_t n_3) | |
| Constructor creating a matrix of dimension \(n_1 \times n_2 \times n_3\). | |
| matrix3d (const matrix3d< T > &mat) | |
| Copy constructor. | |
| matrix3d (std::istream &is, std::streamsize max=10) | |
| Constructor to read a matrix from a stream. | |
| virtual | ~matrix3d () |
| Empty destructor. | |
| void | resize (size_t n_1, size_t n_2, size_t n_3, bool forceClear=false) |
| Resize the matrix to dimension \(n_1 \times n_2 \times n_3\). More... | |
| matrix3d< T > & | operator= (const matrix3d< T > &A) |
| Assignment operator. | |
| T & | operator() (size_t i1, size_t i2, size_t i3) |
| Index-1 based element access. More... | |
| const T & | operator() (size_t i1, size_t i2, size_t i3) const |
| Index-1 based element access. More... | |
| vector< T > | getColumn (size_t i2, size_t i3) const |
| Extract a column from the matrix. | |
| void | fillColumn (size_t i2, size_t i3, const std::vector< T > &data) |
| Fill a column of the matrix. | |
| T | trace (size_t i1) const |
| Return the trace of the i1'th sub-matrix. | |
| matrix3d< T > & | operator+= (const matrix3d< T > &X) |
| Add the given matrix X to *this. | |
| matrix3d< T > & | operator-= (const matrix3d< T > &X) |
| Subtract the given matrix X from *this. | |
| matrix3d< T > & | add (const matrix3d< T > &X, T alfa=T(1)) |
| Add the given matrix X scaled by alfa to *this. | |
| matrix3d< T > & | multiply (T c) |
| Multiplication of this matrix by a scalar c. | |
| bool | multiply (const matrix< T > &A, const matrix3d< T > &B, bool transA=false, bool addTo=false) |
| Matrix-matrix multiplication. More... | |
| bool | multiplyMat (const std::vector< T > &A, const matrix3d< T > &B, bool addTo=false) |
| Matrix-matrix multiplication. More... | |
Public Member Functions inherited from utl::matrixBase< T > | |
| 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 | |
| virtual void | clearIfNrowChanged (size_t n1, size_t n2, size_t) |
| Clears the content if any of the first two dimensions changed. | |
Protected Member Functions inherited from utl::matrixBase< T > | |
| 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... | |
Private Member Functions | |
| bool | compatible (const matrix< T > &A, const matrix3d< T > &B, bool transA, size_t &M, size_t &N, size_t &K) |
| Check dimension compatibility for matrix-matrix multiplication. | |
| bool | compatible (const std::vector< T > &A, const matrix3d< T > &B, size_t &M, size_t &N, size_t &K) |
| Check dimension compatibility for matrix-matrix multiplication, when the matrix A is represented by a one-dimensional vector. | |
Additional Inherited Members | |
Protected Attributes inherited from utl::matrixBase< T > | |
| size_t | n [4] |
| Dimension of the matrix. | |
| vector< T > & | elem |
| Actual matrix elements, stored column by column. | |
Three-dimensional rectangular matrix with some algebraic operations.
This is a 3D equivalent to the matrix class. The matrix elements are stored column-wise in a one-dimensional array, such that its pointer might be passed to Fortran subroutines requiring 3D arrays as arguments.
|
inline |
Matrix-matrix multiplication.
Performs one of the following operations (C = *this):
References K, M, and utl::matrixBase< T >::n.
|
inline |
Matrix-matrix multiplication.
Performs one of the following operations (C = *this):
The matrix A is here represented by a one-dimensional vector, and its number of columns is assumed to match the first dimension of B and its number of rows is then the total vector length divided by the number of columns.
References K, M, and utl::matrixBase< T >::n.
|
inline |
Index-1 based element access.
Assuming column-wise storage as in Fortran.
|
inline |
Index-1 based element access.
Assuming column-wise storage as in Fortran.
|
inline |
Resize the matrix to dimension \(n_1 \times n_2 \times n_3\).
Will erase the previous content, but only if both the total matrix size, and n_1 or n_2 in the matrix are changed. It is therefore possible to add or remove a given number of elements in the third dimension of the matrix without loosing the contents of the first and second dimensions. If forceClear is true, the old matrix content is always erased.
References utl::matrixBase< T >::redim().
Referenced by ASMu3D::evaluateBasis(), SplineUtils::extractBasis(), ASMs1D::extractBasis(), utl::Hessian(), LRSplineFields2Dmx::hessianFE(), LRSplineFields3Dmx::hessianFE(), SplineFields2Dmx::hessianFE(), SplineFields3Dmx::hessianFE(), utl::matrix3d< T >::matrix3d(), and HDF5Reader::read3DArray().