|
OpenMD 3.2
Molecular Dynamics in the Open
|
Rectangular matrix class with contiguous flat storage. More...
#include "math/DynamicRectMatrix.hpp"
Public Types | |
| using | ElemType = Real |
| using | ElemPoinerType = Real* |
| using | SelfType = DynamicRectMatrix<Real> |
Public Member Functions | |
| DynamicRectMatrix () | |
| default constructor | |
| DynamicRectMatrix (unsigned int nrow, unsigned int ncol) | |
| DynamicRectMatrix (unsigned int nrow, unsigned int ncol, Real s) | |
| Constructs and initializes every element of this matrix to a scalar. | |
| DynamicRectMatrix (unsigned int nrow, unsigned int ncol, Real *array) | |
| DynamicRectMatrix (const SelfType &m)=default | |
| copy constructor | |
| DynamicRectMatrix (SelfType &&m) noexcept=default | |
| move constructor | |
| ~DynamicRectMatrix ()=default | |
| destructor | |
| DynamicRectMatrix< Real > & | operator= (const DynamicRectMatrix< Real > &m)=default |
| copy assignment operator | |
| DynamicRectMatrix< Real > & | operator= (DynamicRectMatrix< Real > &&m) noexcept=default |
| move assignment operator | |
| Real & | operator() (unsigned int i, unsigned int j) |
| Returns the reference of a single element of this matrix. | |
| Real | operator() (unsigned int i, unsigned int j) const |
| Returns the value of a single element of this matrix. | |
| void | getArray (Real *array) const |
| Copies the internal data to an array (row-major order). | |
| Real * | getArrayPointer () |
| Returns a pointer to the contiguous internal storage (row-major). | |
| const Real * | getArrayPointer () const |
| DynamicVector< Real > | getRow (unsigned int row) |
| Returns a row of this matrix as a vector. | |
| void | setRow (unsigned int row, const DynamicVector< Real > &v) |
| Sets a row of this matrix. | |
| DynamicVector< Real > | getColumn (unsigned int col) |
| Returns a column of this matrix as a vector. | |
| void | setColumn (unsigned int col, const DynamicVector< Real > &v) |
| Sets a column of this matrix. | |
| void | swapRow (unsigned int i, unsigned int j) |
| swap two rows of this matrix | |
| void | swapColumn (unsigned int i, unsigned int j) |
| swap two columns of this matrix | |
| DynamicVector< Real > | diagonals () const |
| Returns a DynamicVector of the diagonal elements. | |
| bool | operator== (const DynamicRectMatrix< Real > &m) const |
| Tests if this matrix is identical to matrix m. | |
| bool | operator!= (const DynamicRectMatrix< Real > &m) const |
| Tests if this matrix is not equal to matrix m. | |
| void | negate () |
| Negates the value of this matrix in place. | |
| void | negate (const DynamicRectMatrix< Real > &m) |
| Sets the value of this matrix to the negation of matrix m. | |
| void | add (const DynamicRectMatrix< Real > &m) |
| Sets the value of this matrix to the sum of itself and m (*this += m). | |
| void | add (const DynamicRectMatrix< Real > &m1, const DynamicRectMatrix< Real > &m2) |
| Sets the value of this matrix to the sum of m1 and m2 (*this = m1 + m2). | |
| void | sub (const DynamicRectMatrix< Real > &m) |
| Sets the value of this matrix to the difference of itself and m (*this -= m). | |
| void | sub (const DynamicRectMatrix< Real > &m1, const DynamicRectMatrix< Real > &m2) |
| Sets the value of this matrix to the difference of matrix m1 and m2 (*this = m1 - m2). | |
| void | mul (Real s) |
| Sets the value of this matrix to the scalar multiplication of itself (*this *= s). | |
| void | mul (Real s, const DynamicRectMatrix< Real > &m) |
| Sets the value of this matrix to the scalar multiplication of matrix m (*this = s * m). | |
| void | div (Real s) |
| Sets the value of this matrix to the scalar division of itself (*this /= s). | |
| void | div (Real s, const DynamicRectMatrix< Real > &m) |
| Sets the value of this matrix to the scalar division of matrix m (*this = m / s). | |
| DynamicRectMatrix< Real > & | operator*= (const Real s) |
| Multiples a scalar onto every element of this matrix. | |
| DynamicRectMatrix< Real > & | operator/= (const Real s) |
| Divides every element of this matrix by a scalar. | |
| DynamicRectMatrix< Real > & | operator+= (const DynamicRectMatrix< Real > &m) |
| Sets the value of this matrix to the sum of the other matrix and itself (*this += m). | |
| DynamicRectMatrix< Real > & | operator-= (const DynamicRectMatrix< Real > &m) |
| Sets the value of this matrix to the difference of itself and the other matrix (*this -= m). | |
| DynamicRectMatrix< Real > | transpose () const |
| Return the transpose of this matrix. | |
| unsigned int | getNRow () const |
| unsigned int | getNCol () const |
| template<class MatrixType> | |
| void | setSubMatrix (unsigned int beginRow, unsigned int beginCol, const MatrixType &m) |
| template<class MatrixType> | |
| void | getSubMatrix (unsigned int beginRow, unsigned int beginCol, MatrixType &m) |
Protected Attributes | |
| unsigned int | nrow_ |
| unsigned int | ncol_ |
| std::vector< Real > | data_ |
Rectangular matrix class with contiguous flat storage.
Elements are stored in row-major order in a single contiguous std::vector<Real>. Element (i,j) is at data_[i*ncol_ + j]. The contiguous layout allows direct interop with BLAS/LAPACK (via getArrayPointer()) without an intermediate copy.
Definition at line 78 of file DynamicRectMatrix.hpp.
| using OpenMD::DynamicRectMatrix< Real >::ElemPoinerType = Real* |
Definition at line 81 of file DynamicRectMatrix.hpp.
| using OpenMD::DynamicRectMatrix< Real >::ElemType = Real |
Definition at line 80 of file DynamicRectMatrix.hpp.
| using OpenMD::DynamicRectMatrix< Real >::SelfType = DynamicRectMatrix<Real> |
Definition at line 82 of file DynamicRectMatrix.hpp.
|
inline |
default constructor
Definition at line 85 of file DynamicRectMatrix.hpp.
|
inline |
Definition at line 87 of file DynamicRectMatrix.hpp.
|
inline |
Constructs and initializes every element of this matrix to a scalar.
Definition at line 91 of file DynamicRectMatrix.hpp.
|
inline |
Definition at line 94 of file DynamicRectMatrix.hpp.
|
inline |
Sets the value of this matrix to the sum of itself and m (*this += m).
| m | the other matrix |
Definition at line 255 of file DynamicRectMatrix.hpp.
|
inline |
Sets the value of this matrix to the sum of m1 and m2 (*this = m1 + m2).
| m1 | the first matrix |
| m2 | the second matrix |
Definition at line 266 of file DynamicRectMatrix.hpp.
|
inline |
Returns a DynamicVector of the diagonal elements.
Definition at line 209 of file DynamicRectMatrix.hpp.
|
inline |
Sets the value of this matrix to the scalar division of itself (*this /= s).
| s | the scalar value |
Definition at line 323 of file DynamicRectMatrix.hpp.
|
inline |
Sets the value of this matrix to the scalar division of matrix m (*this = m / s).
| s | the scalar value |
| m | the matrix |
Definition at line 333 of file DynamicRectMatrix.hpp.
|
inline |
Copies the internal data to an array (row-major order).
| array | the pointer of destination array |
Definition at line 134 of file DynamicRectMatrix.hpp.
|
inline |
Returns a pointer to the contiguous internal storage (row-major).
Definition at line 140 of file DynamicRectMatrix.hpp.
|
inline |
Definition at line 141 of file DynamicRectMatrix.hpp.
|
inline |
Returns a column of this matrix as a vector.
| col | the column index |
Definition at line 169 of file DynamicRectMatrix.hpp.
|
inline |
Definition at line 387 of file DynamicRectMatrix.hpp.
|
inline |
Definition at line 386 of file DynamicRectMatrix.hpp.
|
inline |
Returns a row of this matrix as a vector.
| row | the row index |
Definition at line 147 of file DynamicRectMatrix.hpp.
|
inline |
Definition at line 400 of file DynamicRectMatrix.hpp.
|
inline |
Sets the value of this matrix to the scalar multiplication of itself (*this *= s).
| s | the scalar value |
Definition at line 302 of file DynamicRectMatrix.hpp.
|
inline |
Sets the value of this matrix to the scalar multiplication of matrix m (*this = s * m).
| s | the scalar value |
| m | the matrix |
Definition at line 312 of file DynamicRectMatrix.hpp.
|
inline |
Negates the value of this matrix in place.
Definition at line 237 of file DynamicRectMatrix.hpp.
|
inline |
Sets the value of this matrix to the negation of matrix m.
| m | the source matrix |
Definition at line 245 of file DynamicRectMatrix.hpp.
|
inline |
Tests if this matrix is not equal to matrix m.
| m | matrix to be compared |
Definition at line 232 of file DynamicRectMatrix.hpp.
|
inline |
Returns the reference of a single element of this matrix.
| i | row index |
| j | column index |
Definition at line 117 of file DynamicRectMatrix.hpp.
|
inline |
Returns the value of a single element of this matrix.
| i | row index |
| j | column index |
Definition at line 126 of file DynamicRectMatrix.hpp.
|
inline |
Multiples a scalar onto every element of this matrix.
| s | the scalar value |
Definition at line 343 of file DynamicRectMatrix.hpp.
|
inline |
Sets the value of this matrix to the sum of the other matrix and itself (*this += m).
| m | the other matrix |
Definition at line 362 of file DynamicRectMatrix.hpp.
|
inline |
Sets the value of this matrix to the difference of itself and the other matrix (*this -= m).
| m | the other matrix |
Definition at line 372 of file DynamicRectMatrix.hpp.
|
inline |
Divides every element of this matrix by a scalar.
| s | the scalar value |
Definition at line 352 of file DynamicRectMatrix.hpp.
|
inline |
Tests if this matrix is identical to matrix m.
| m | matrix to be compared |
Definition at line 221 of file DynamicRectMatrix.hpp.
|
inline |
Sets a column of this matrix.
| col | the column index |
| v | the vector to be set |
Definition at line 181 of file DynamicRectMatrix.hpp.
|
inline |
Sets a row of this matrix.
| row | the row index |
| v | the vector to be set |
Definition at line 159 of file DynamicRectMatrix.hpp.
|
inline |
Definition at line 390 of file DynamicRectMatrix.hpp.
|
inline |
Sets the value of this matrix to the difference of itself and m (*this -= m).
| m | the other matrix |
Definition at line 278 of file DynamicRectMatrix.hpp.
|
inline |
Sets the value of this matrix to the difference of matrix m1 and m2 (*this = m1 - m2).
| m1 | the first matrix |
| m2 | the second matrix |
Definition at line 290 of file DynamicRectMatrix.hpp.
|
inline |
swap two columns of this matrix
| i | the first column |
| j | the second column |
Definition at line 202 of file DynamicRectMatrix.hpp.
|
inline |
swap two rows of this matrix
| i | the first row |
| j | the second row |
Definition at line 191 of file DynamicRectMatrix.hpp.
|
inline |
Return the transpose of this matrix.
Definition at line 378 of file DynamicRectMatrix.hpp.
|
protected |
Definition at line 412 of file DynamicRectMatrix.hpp.
|
protected |
Definition at line 411 of file DynamicRectMatrix.hpp.
|
protected |
Definition at line 410 of file DynamicRectMatrix.hpp.