OpenMD  2.5
Molecular Dynamics in the Open
OpenMD::SquareMatrix< Real, Dim > Class Template Reference

A square matrix class. More...

#include "math/SquareMatrix.hpp"

Inheritance diagram for OpenMD::SquareMatrix< Real, Dim >:
OpenMD::RectMatrix< Real, Dim, Dim >

Public Types

typedef Real ElemType
 
typedef Real * ElemPoinerType
 
- Public Types inherited from OpenMD::RectMatrix< Real, Dim, Dim >
typedef Real ElemType
 
typedef Real * ElemPoinerType
 

Public Member Functions

 SquareMatrix ()
 
 SquareMatrix (Real s)
 
 SquareMatrix (Real *array)
 
 SquareMatrix (const RectMatrix< Real, Dim, Dim > &m)
 
SquareMatrix< Real, Dim > & operator= (const RectMatrix< Real, Dim, Dim > &m)
 
SquareMatrix< Real, Dim > inverse ()
 
Real determinant () const
 
Real trace () const
 
bool isSymmetric () const
 
bool isOrthogonal ()
 
bool isDiagonal () const
 
Vector< Real, Dim > diagonals () const
 
bool isUnitMatrix () const
 
SquareMatrix< Real, Dim > transpose () const
 
void diagonalize ()
 
- Public Member Functions inherited from OpenMD::RectMatrix< Real, Dim, Dim >
 RectMatrix ()
 
 RectMatrix (Real s)
 
 RectMatrix (Real *array)
 
 RectMatrix (const RectMatrix< Real, Row, Col > &m)
 
 ~RectMatrix ()
 
RectMatrix< Real, Row, Col > & operator= (const RectMatrix< Real, Row, Col > &m)
 
Real & operator() (unsigned int i, unsigned int j)
 
Real operator() (unsigned int i, unsigned int j) const
 
void getArray (Real *array)
 
Real * getArrayPointer ()
 
Vector< Real, Row > getRow (unsigned int row)
 
void setRow (unsigned int row, const Vector< Real, Row > &v)
 
Vector< Real, Col > getColumn (unsigned int col)
 
void setColumn (unsigned int col, const Vector< Real, Col > &v)
 
void swapRow (unsigned int i, unsigned int j)
 
void swapColumn (unsigned int i, unsigned int j)
 
bool operator== (const RectMatrix< Real, Row, Col > &m)
 
bool operator!= (const RectMatrix< Real, Row, Col > &m)
 
void negate ()
 
void negate (const RectMatrix< Real, Row, Col > &m)
 
void add (const RectMatrix< Real, Row, Col > &m)
 
void add (const RectMatrix< Real, Row, Col > &m1, const RectMatrix< Real, Row, Col > &m2)
 
void sub (const RectMatrix< Real, Row, Col > &m)
 
void sub (const RectMatrix< Real, Row, Col > &m1, const RectMatrix< Real, Row, Col > &m2)
 
void mul (Real s)
 
void mul (Real s, const RectMatrix< Real, Row, Col > &m)
 
void div (Real s)
 
void div (Real s, const RectMatrix< Real, Row, Col > &m)
 
RectMatrix< Real, Row, Col > & operator*= (const Real s)
 
RectMatrix< Real, Row, Col > & operator/= (const Real s)
 
RectMatrix< Real, Row, Col > & operator+= (const RectMatrix< Real, Row, Col > &m)
 
RectMatrix< Real, Row, Col > & operator-= (const RectMatrix< Real, Row, Col > &m)
 
RectMatrix< Real, Col, Row > transpose () const
 
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
 

Static Public Member Functions

static SquareMatrix< Real, Dim > identity ()
 
static int jacobi (SquareMatrix< Real, Dim > &a, Vector< Real, Dim > &d, SquareMatrix< Real, Dim > &v)
 

Additional Inherited Members

- Protected Attributes inherited from OpenMD::RectMatrix< Real, Dim, Dim >
Real data_ [Row][Col]
 

Detailed Description

template<typename Real, int Dim>
class OpenMD::SquareMatrix< Real, Dim >

A square matrix class.

Template Parameters
Realthe element type
Dimthe dimension of the square matrix

Definition at line 63 of file SquareMatrix.hpp.

Member Typedef Documentation

◆ ElemPoinerType

template<typename Real, int Dim>
typedef Real* OpenMD::SquareMatrix< Real, Dim >::ElemPoinerType

Definition at line 66 of file SquareMatrix.hpp.

◆ ElemType

template<typename Real, int Dim>
typedef Real OpenMD::SquareMatrix< Real, Dim >::ElemType

Definition at line 65 of file SquareMatrix.hpp.

Constructor & Destructor Documentation

◆ SquareMatrix() [1/4]

template<typename Real, int Dim>
OpenMD::SquareMatrix< Real, Dim >::SquareMatrix ( )
inline

default constructor

Definition at line 69 of file SquareMatrix.hpp.

◆ SquareMatrix() [2/4]

template<typename Real, int Dim>
OpenMD::SquareMatrix< Real, Dim >::SquareMatrix ( Real  s)
inline

Constructs and initializes every element of this matrix to a scalar

Definition at line 76 of file SquareMatrix.hpp.

◆ SquareMatrix() [3/4]

template<typename Real, int Dim>
OpenMD::SquareMatrix< Real, Dim >::SquareMatrix ( Real *  array)
inline

Constructs and initializes from an array

Definition at line 80 of file SquareMatrix.hpp.

◆ SquareMatrix() [4/4]

template<typename Real, int Dim>
OpenMD::SquareMatrix< Real, Dim >::SquareMatrix ( const RectMatrix< Real, Dim, Dim > &  m)
inline

copy constructor

Definition at line 85 of file SquareMatrix.hpp.

Member Function Documentation

◆ determinant()

template<typename Real, int Dim>
Real OpenMD::SquareMatrix< Real, Dim >::determinant ( ) const
inline

Returns the determinant of this matrix.

Todo:
need implementation

Definition at line 123 of file SquareMatrix.hpp.

◆ diagonalize()

template<typename Real, int Dim>
void OpenMD::SquareMatrix< Real, Dim >::diagonalize ( )
inline
Todo:
need implementation

Definition at line 204 of file SquareMatrix.hpp.

◆ diagonals()

template<typename Real, int Dim>
Vector<Real, Dim> OpenMD::SquareMatrix< Real, Dim >::diagonals ( ) const
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 172 of file SquareMatrix.hpp.

Referenced by OpenMD::Electrostatic::ReciprocalSpaceSum().

◆ identity()

template<typename Real, int Dim>
static SquareMatrix<Real, Dim> OpenMD::SquareMatrix< Real, Dim >::identity ( )
inlinestatic

Retunrs an identity matrix

Definition at line 96 of file SquareMatrix.hpp.

◆ inverse()

template<typename Real, int Dim>
SquareMatrix<Real, Dim> OpenMD::SquareMatrix< Real, Dim >::inverse ( )
inline

Retunrs the inversion of this matrix.

Todo:
need implementation

Definition at line 113 of file SquareMatrix.hpp.

◆ isDiagonal()

template<typename Real, int Dim>
bool OpenMD::SquareMatrix< Real, Dim >::isDiagonal ( ) const
inline

Tests if this matrix is diagonal.

Definition at line 158 of file SquareMatrix.hpp.

Referenced by OpenMD::SquareMatrix< RealType, 6 >::isOrthogonal(), and OpenMD::SquareMatrix< RealType, 6 >::isUnitMatrix().

◆ isOrthogonal()

template<typename Real, int Dim>
bool OpenMD::SquareMatrix< Real, Dim >::isOrthogonal ( )
inline

Tests if this matrix is orthogonal.

Definition at line 149 of file SquareMatrix.hpp.

◆ isSymmetric()

template<typename Real, int Dim>
bool OpenMD::SquareMatrix< Real, Dim >::isSymmetric ( ) const
inline

Tests if this matrix is symmetrix.

Definition at line 139 of file SquareMatrix.hpp.

◆ isUnitMatrix()

template<typename Real, int Dim>
bool OpenMD::SquareMatrix< Real, Dim >::isUnitMatrix ( ) const
inline

Tests if this matrix is the unit matrix.

Definition at line 181 of file SquareMatrix.hpp.

◆ jacobi()

template<typename Real, int Dim>
int OpenMD::SquareMatrix< Real, Dim >::jacobi ( SquareMatrix< Real, Dim > &  a,
Vector< Real, Dim > &  d,
SquareMatrix< Real, Dim > &  v 
)
static

Jacobi iteration routines for computing eigenvalues/eigenvectors of real symmetric matrix

Returns
true if success, otherwise return false
Parameters
asymmetric matrix whose eigenvectors are to be computed. On return, the matrix is overwritten
dwill contain the eigenvalues of the matrix On return of this function
vthe columns of this matrix will contain the eigenvectors. The eigenvectors are normalized and mutually orthogonal.

Definition at line 251 of file SquareMatrix.hpp.

Referenced by OpenMD::SquareMatrix< RealType, 6 >::diagonalize().

◆ operator=()

template<typename Real, int Dim>
SquareMatrix<Real, Dim>& OpenMD::SquareMatrix< Real, Dim >::operator= ( const RectMatrix< Real, Dim, Dim > &  m)
inline

copy assignment operator

Definition at line 89 of file SquareMatrix.hpp.

Referenced by OpenMD::SquareMatrix3< RealType >::operator=().

◆ trace()

◆ transpose()

template<typename Real, int Dim>
SquareMatrix<Real, Dim> OpenMD::SquareMatrix< Real, Dim >::transpose ( ) const
inline

Return the transpose of this matrix

Definition at line 193 of file SquareMatrix.hpp.

Referenced by OpenMD::SquareMatrix< RealType, 6 >::isOrthogonal().


The documentation for this class was generated from the following file: