OpenMD 3.1
Molecular Dynamics in the Open
|
rectangular matrix class More...
#include "math/RectMatrix.hpp"
Public Types | |
using | ElemType = Real |
using | ElemPoinerType = Real* |
Public Member Functions | |
RectMatrix () | |
default constructor | |
RectMatrix (Real s) | |
Constructs and initializes every element of this matrix to a scalar. | |
RectMatrix (Real *array) | |
RectMatrix (const RectMatrix< Real, Row, Col > &m) | |
copy constructor | |
~RectMatrix () | |
destructor | |
RectMatrix< Real, Row, Col > & | operator= (const RectMatrix< Real, Row, Col > &m) |
copy assignment operator | |
Real & | operator() (unsigned int i, unsigned int j) |
Return the reference of a single element of this matrix. | |
Real | operator() (unsigned int i, unsigned int j) const |
Return the value of a single element of this matrix. | |
void | getArray (Real *array) |
Copy the internal data to an array. | |
Real * | getArrayPointer () |
Returns the pointer of internal array. | |
Vector< Real, Row > | getRow (unsigned int row) |
Returns a row of this matrix as a vector. | |
void | setRow (unsigned int row, const Vector< Real, Row > &v) |
Sets a row of this matrix. | |
Vector< Real, Col > | getColumn (unsigned int col) |
Returns a column of this matrix as a vector. | |
void | setColumn (unsigned int col, const Vector< Real, Col > &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 | |
bool | operator== (const RectMatrix< Real, Row, Col > &m) |
Tests if this matrix is identical to matrix m. | |
bool | operator!= (const RectMatrix< Real, Row, Col > &m) |
Tests if this matrix is not equal to matrix m. | |
void | negate () |
Negates the value of this matrix in place. | |
void | negate (const RectMatrix< Real, Row, Col > &m) |
Sets the value of this matrix to the negation of matrix m. | |
void | add (const RectMatrix< Real, Row, Col > &m) |
Sets the value of this matrix to the sum of itself and m (*this += m). | |
void | add (const RectMatrix< Real, Row, Col > &m1, const RectMatrix< Real, Row, Col > &m2) |
Sets the value of this matrix to the sum of m1 and m2 (*this = m1 + m2). | |
void | sub (const RectMatrix< Real, Row, Col > &m) |
Sets the value of this matrix to the difference of itself and m (*this -= m). | |
void | sub (const RectMatrix< Real, Row, Col > &m1, const RectMatrix< Real, Row, Col > &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 RectMatrix< Real, Row, Col > &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 RectMatrix< Real, Row, Col > &m) |
Sets the value of this matrix to the scalar division of matrix m (*this = m /s). | |
RectMatrix< Real, Row, Col > & | operator*= (const Real s) |
Multiples a scalar into every element of this matrix. | |
RectMatrix< Real, Row, Col > & | operator/= (const Real s) |
Divides every element of this matrix by a scalar. | |
RectMatrix< Real, Row, Col > & | operator+= (const RectMatrix< Real, Row, Col > &m) |
Sets the value of this matrix to the sum of the other matrix and itself (*this += m). | |
RectMatrix< Real, Row, Col > & | operator-= (const RectMatrix< Real, Row, Col > &m) |
Sets the value of this matrix to the differerence of itself and the other matrix (*this -= m) | |
RectMatrix< Real, Col, Row > | transpose () const |
Return the transpose of this matrix. | |
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) |
unsigned int | getNRow () const |
unsigned int | getNCol () const |
Real | frobeniusNorm () |
Protected Attributes | |
Real | data_ [Row][Col] |
rectangular matrix class
Definition at line 66 of file RectMatrix.hpp.
using OpenMD::RectMatrix< Real, Row, Col >::ElemPoinerType = Real* |
Definition at line 69 of file RectMatrix.hpp.
using OpenMD::RectMatrix< Real, Row, Col >::ElemType = Real |
Definition at line 68 of file RectMatrix.hpp.
|
inline |
default constructor
Definition at line 72 of file RectMatrix.hpp.
|
inline |
Constructs and initializes every element of this matrix to a scalar.
Definition at line 79 of file RectMatrix.hpp.
|
inline |
Definition at line 85 of file RectMatrix.hpp.
|
inline |
copy constructor
Definition at line 92 of file RectMatrix.hpp.
|
inline |
destructor
Definition at line 95 of file RectMatrix.hpp.
|
inline |
Sets the value of this matrix to the sum of itself and m (*this += m).
m | the other matrix |
Definition at line 262 of file RectMatrix.hpp.
Referenced by OpenMD::operator+(), and OpenMD::RectMatrix< Real, Row, Col >::operator+=().
|
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 273 of file RectMatrix.hpp.
|
inline |
Sets the value of this matrix to the scalar division of itself (*this /= s ).
s | the scalar value |
Definition at line 332 of file RectMatrix.hpp.
Referenced by OpenMD::operator/(), and OpenMD::RectMatrix< Real, Row, Col >::operator/=().
|
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 344 of file RectMatrix.hpp.
|
inline |
Definition at line 426 of file RectMatrix.hpp.
|
inline |
Copy the internal data to an array.
array | the pointer of destination array |
Definition at line 132 of file RectMatrix.hpp.
|
inline |
Returns the pointer of internal array.
Definition at line 141 of file RectMatrix.hpp.
Referenced by OpenMD::Thermo::getInertiaTensor(), OpenMD::Thermo::getPressureTensor(), OpenMD::Thermo::getPressureTensor(), and OpenMD::Thermo::getSystemQuadrupole().
|
inline |
Returns a column of this matrix as a vector.
col | the column index |
Definition at line 172 of file RectMatrix.hpp.
Referenced by OpenMD::GhostBend::calcForce().
|
inline |
Definition at line 424 of file RectMatrix.hpp.
|
inline |
Definition at line 423 of file RectMatrix.hpp.
|
inline |
Returns a row of this matrix as a vector.
row | the row index |
Definition at line 148 of file RectMatrix.hpp.
Referenced by OpenMD::SquareMatrix3< Real >::diagonalize().
|
inline |
Definition at line 413 of file RectMatrix.hpp.
|
inline |
Sets the value of this matrix to the scalar multiplication of itself (*this *= s).
s | the scalar value |
Definition at line 309 of file RectMatrix.hpp.
Referenced by OpenMD::operator*(), OpenMD::operator*(), and OpenMD::RectMatrix< Real, Row, Col >::operator*=().
|
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 321 of file RectMatrix.hpp.
|
inline |
Negates the value of this matrix in place.
Definition at line 242 of file RectMatrix.hpp.
Referenced by OpenMD::operator-().
|
inline |
Sets the value of this matrix to the negation of matrix m.
m | the source matrix |
Definition at line 252 of file RectMatrix.hpp.
|
inline |
Tests if this matrix is not equal to matrix m.
m | matrix to be compared |
Definition at line 237 of file RectMatrix.hpp.
|
inline |
Return the reference of a single element of this matrix.
i | row index |
j | Column index |
Definition at line 113 of file RectMatrix.hpp.
|
inline |
Return the value of a single element of this matrix.
i | row index |
j | Column index |
Definition at line 124 of file RectMatrix.hpp.
|
inline |
Multiples a scalar into every element of this matrix.
s | the scalar value |
Definition at line 354 of file RectMatrix.hpp.
References OpenMD::RectMatrix< Real, Row, Col >::mul().
|
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 373 of file RectMatrix.hpp.
References OpenMD::RectMatrix< Real, Row, Col >::add().
|
inline |
Sets the value of this matrix to the differerence of itself and the other matrix (*this -= m)
m | the other matrix |
Definition at line 384 of file RectMatrix.hpp.
References OpenMD::RectMatrix< Real, Row, Col >::sub().
|
inline |
Divides every element of this matrix by a scalar.
s | the scalar value |
Definition at line 363 of file RectMatrix.hpp.
References OpenMD::RectMatrix< Real, Row, Col >::div().
|
inline |
copy assignment operator
Definition at line 98 of file RectMatrix.hpp.
Referenced by OpenMD::SquareMatrix< Real, Dim >::operator=().
|
inline |
Tests if this matrix is identical to matrix m.
m | matrix to be compared |
Definition at line 223 of file RectMatrix.hpp.
References OpenMD::equal().
|
inline |
Sets a column of this matrix.
col | the column index |
v | the vector to be set |
Definition at line 186 of file RectMatrix.hpp.
|
inline |
Sets a row of this matrix.
row | the row index |
v | the vector to be set |
Definition at line 162 of file RectMatrix.hpp.
Referenced by OpenMD::SquareMatrix3< Real >::diagonalize().
|
inline |
Definition at line 402 of file RectMatrix.hpp.
|
inline |
Sets the value of this matrix to the difference of itself and m (*this -= m).
m | the other matrix |
Definition at line 285 of file RectMatrix.hpp.
Referenced by OpenMD::operator-(), and OpenMD::RectMatrix< Real, Row, Col >::operator-=().
|
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 297 of file RectMatrix.hpp.
|
inline |
swap two Columns of this matrix
i | the first Column |
j | the second Column |
Definition at line 208 of file RectMatrix.hpp.
|
inline |
swap two rows of this matrix
i | the first row |
j | the second row |
Definition at line 196 of file RectMatrix.hpp.
Referenced by OpenMD::SquareMatrix3< Real >::diagonalize().
|
inline |
Return the transpose of this matrix.
Definition at line 391 of file RectMatrix.hpp.
|
protected |
Definition at line 437 of file RectMatrix.hpp.