OpenMD 3.1
Molecular Dynamics in the Open
|
A square matrix class. More...
#include "math/SquareMatrix.hpp"
Public Types | |
using | ElemType = Real |
using | ElemPoinerType = Real* |
Public Types inherited from OpenMD::RectMatrix< Real, Dim, Dim > | |
using | ElemType |
using | ElemPoinerType |
Public Member Functions | |
SquareMatrix () | |
default constructor | |
SquareMatrix (Real s) | |
Constructs and initializes every element of this matrix to a scalar. | |
SquareMatrix (Real *array) | |
Constructs and initializes from an array. | |
SquareMatrix (const RectMatrix< Real, Dim, Dim > &m) | |
copy constructor | |
SquareMatrix< Real, Dim > & | operator= (const RectMatrix< Real, Dim, Dim > &m) |
copy assignment operator | |
SquareMatrix< Real, Dim > | inverse () |
Returns the inverse of this matrix. | |
Real | determinant () const |
Returns the determinant of this matrix. | |
SquareMatrix< Real, Dim - 1 > | cofactor (int p, int q) |
Real | trace () const |
Returns the trace of this matrix. | |
bool | isSymmetric () const |
Tests if this matrix is symmetrix. | |
bool | isOrthogonal () |
Tests if this matrix is orthogonal. | |
bool | isDiagonal () const |
Tests if this matrix is diagonal. | |
Vector< Real, Dim > | diagonals () const |
Returns a column vector that contains the elements from the diagonal of m in the order R(0) = m(0,0), R(1) = m(1,1), and so on. | |
bool | isUnitMatrix () const |
Tests if this matrix is the unit matrix. | |
SquareMatrix< Real, Dim > | transpose () const |
Return the transpose of this matrix. | |
void | diagonalize () |
Public Member Functions inherited from OpenMD::RectMatrix< Real, Dim, Dim > | |
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. | |
void | setSubMatrix (unsigned int beginRow, unsigned int beginCol, const MatrixType &m) |
void | getSubMatrix (unsigned int beginRow, unsigned int beginCol, MatrixType &m) |
unsigned int | getNRow () const |
unsigned int | getNCol () const |
Real | frobeniusNorm () |
Static Public Member Functions | |
static SquareMatrix< Real, Dim > | identity () |
Returns an identity matrix. | |
static int | jacobi (SquareMatrix< Real, Dim > &a, Vector< Real, Dim > &d, SquareMatrix< Real, Dim > &v) |
Jacobi iteration routines for computing eigenvalues/eigenvectors of real symmetric matrix. | |
Additional Inherited Members | |
Protected Attributes inherited from OpenMD::RectMatrix< Real, Dim, Dim > | |
Real | data_ [Row][Col] |
A square matrix class.
Real | the element type |
Dim | the dimension of the square matrix |
Definition at line 66 of file SquareMatrix.hpp.
using OpenMD::SquareMatrix< Real, Dim >::ElemPoinerType = Real* |
Definition at line 69 of file SquareMatrix.hpp.
using OpenMD::SquareMatrix< Real, Dim >::ElemType = Real |
Definition at line 68 of file SquareMatrix.hpp.
|
inline |
default constructor
Definition at line 72 of file SquareMatrix.hpp.
|
inline |
Constructs and initializes every element of this matrix to a scalar.
Definition at line 79 of file SquareMatrix.hpp.
|
inline |
Constructs and initializes from an array.
Definition at line 82 of file SquareMatrix.hpp.
|
inline |
copy constructor
Definition at line 85 of file SquareMatrix.hpp.
|
inline |
Definition at line 145 of file SquareMatrix.hpp.
|
inline |
Returns the determinant of this matrix.
Definition at line 126 of file SquareMatrix.hpp.
|
inline |
Definition at line 242 of file SquareMatrix.hpp.
|
inline |
Returns a column vector that contains the elements from the diagonal of m in the order R(0) = m(0,0), R(1) = m(1,1), and so on.
Definition at line 212 of file SquareMatrix.hpp.
|
inlinestatic |
Returns an identity matrix.
Definition at line 96 of file SquareMatrix.hpp.
|
inline |
Returns the inverse of this matrix.
Definition at line 112 of file SquareMatrix.hpp.
References OpenMD::invertMatrix().
|
inline |
Tests if this matrix is diagonal.
Definition at line 199 of file SquareMatrix.hpp.
Referenced by OpenMD::SquareMatrix< Real, Dim >::isOrthogonal(), and OpenMD::SquareMatrix< Real, Dim >::isUnitMatrix().
|
inline |
Tests if this matrix is orthogonal.
Definition at line 190 of file SquareMatrix.hpp.
References OpenMD::SquareMatrix< Real, Dim >::isDiagonal(), and OpenMD::SquareMatrix< Real, Dim >::transpose().
|
inline |
Tests if this matrix is symmetrix.
Definition at line 180 of file SquareMatrix.hpp.
|
inline |
Tests if this matrix is the unit matrix.
Definition at line 221 of file SquareMatrix.hpp.
References OpenMD::SquareMatrix< Real, Dim >::isDiagonal().
|
static |
Jacobi iteration routines for computing eigenvalues/eigenvectors of real symmetric matrix.
a | symmetric matrix whose eigenvectors are to be computed. On return, the matrix is overwritten |
d | will contain the eigenvalues of the matrix On return of this function |
v | the columns of this matrix will contain the eigenvectors. The eigenvectors are normalized and mutually orthogonal. |
Definition at line 314 of file SquareMatrix.hpp.
|
inline |
copy assignment operator
Definition at line 89 of file SquareMatrix.hpp.
References OpenMD::RectMatrix< Real, Row, Col >::operator=().
Referenced by OpenMD::SquareMatrix3< Real >::operator=().
|
inline |
Returns the trace of this matrix.
Definition at line 170 of file SquareMatrix.hpp.
|
inline |
Return the transpose of this matrix.
Definition at line 231 of file SquareMatrix.hpp.
Referenced by OpenMD::SquareMatrix< Real, Dim >::isOrthogonal().