OpenMD  2.5
Molecular Dynamics in the Open
OpenMD::SquareMatrix3< Real > Class Template Reference

#include <SquareMatrix3.hpp>

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

Public Types

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

Public Member Functions

 SquareMatrix3 ()
 
 SquareMatrix3 (Real s)
 
 SquareMatrix3 (Real *array)
 
 SquareMatrix3 (const SquareMatrix< Real, 3 > &m)
 
 SquareMatrix3 (const Vector3< Real > &eulerAngles)
 
 SquareMatrix3 (Real phi, Real theta, Real psi)
 
 SquareMatrix3 (const Quaternion< Real > &q)
 
 SquareMatrix3 (Real w, Real x, Real y, Real z)
 
SquareMatrix3< Real > & operator= (const SquareMatrix< Real, 3 > &m)
 
SquareMatrix3< Real > & operator= (const Quaternion< Real > &q)
 
void setupRotMat (const Vector3< Real > &eulerAngles)
 
void setupRotMat (Real phi, Real theta, Real psi)
 
void setupRotMat (const Quaternion< Real > &quat)
 
void setupRotMat (Real w, Real x, Real y, Real z)
 
void setupSkewMat (Vector3< Real > v)
 
void setupSkewMat (Real v1, Real v2, Real v3)
 
void axisAngle (Vector3d axis, RealType angle)
 
Quaternion< Real > toQuaternion ()
 
Vector3< Real > toEulerAngles ()
 
Real determinant () const
 
Real trace () const
 
SquareMatrix3< Real > inverse () const
 
SquareMatrix3< Real > transpose () const
 
- Public Member Functions inherited from OpenMD::SquareMatrix< Real, 3 >
 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 void diagonalize (SquareMatrix3< Real > &a, Vector3< Real > &w, SquareMatrix3< Real > &v)
 
- Static Public Member Functions inherited from OpenMD::SquareMatrix< Real, 3 >
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>
class OpenMD::SquareMatrix3< Real >

Definition at line 61 of file SquareMatrix3.hpp.

Member Typedef Documentation

◆ ElemPoinerType

template<typename Real>
typedef Real* OpenMD::SquareMatrix3< Real >::ElemPoinerType

Definition at line 65 of file SquareMatrix3.hpp.

◆ ElemType

template<typename Real>
typedef Real OpenMD::SquareMatrix3< Real >::ElemType

Definition at line 64 of file SquareMatrix3.hpp.

Constructor & Destructor Documentation

◆ SquareMatrix3() [1/8]

template<typename Real>
OpenMD::SquareMatrix3< Real >::SquareMatrix3 ( )
inline

default constructor

Definition at line 68 of file SquareMatrix3.hpp.

◆ SquareMatrix3() [2/8]

template<typename Real>
OpenMD::SquareMatrix3< Real >::SquareMatrix3 ( Real  s)
inline

Constructs and initializes every element of this matrix to a scalar

Definition at line 72 of file SquareMatrix3.hpp.

◆ SquareMatrix3() [3/8]

template<typename Real>
OpenMD::SquareMatrix3< Real >::SquareMatrix3 ( Real *  array)
inline

Constructs and initializes from an array

Definition at line 76 of file SquareMatrix3.hpp.

◆ SquareMatrix3() [4/8]

template<typename Real>
OpenMD::SquareMatrix3< Real >::SquareMatrix3 ( const SquareMatrix< Real, 3 > &  m)
inline

copy constructor

Definition at line 81 of file SquareMatrix3.hpp.

◆ SquareMatrix3() [5/8]

template<typename Real>
OpenMD::SquareMatrix3< Real >::SquareMatrix3 ( const Vector3< Real > &  eulerAngles)
inline

Definition at line 84 of file SquareMatrix3.hpp.

◆ SquareMatrix3() [6/8]

template<typename Real>
OpenMD::SquareMatrix3< Real >::SquareMatrix3 ( Real  phi,
Real  theta,
Real  psi 
)
inline

Definition at line 88 of file SquareMatrix3.hpp.

◆ SquareMatrix3() [7/8]

template<typename Real>
OpenMD::SquareMatrix3< Real >::SquareMatrix3 ( const Quaternion< Real > &  q)
inline

Definition at line 92 of file SquareMatrix3.hpp.

◆ SquareMatrix3() [8/8]

template<typename Real>
OpenMD::SquareMatrix3< Real >::SquareMatrix3 ( Real  w,
Real  x,
Real  y,
Real  z 
)
inline

Definition at line 97 of file SquareMatrix3.hpp.

Member Function Documentation

◆ axisAngle()

template<typename Real>
void OpenMD::SquareMatrix3< Real >::axisAngle ( Vector3d  axis,
RealType  angle 
)
inline

Uses Rodrigues' rotation formula for a rotation matrix.

Parameters
axisthe axis to rotate around
anglethe angle to rotate (in radians)

Definition at line 196 of file SquareMatrix3.hpp.

◆ determinant()

◆ diagonalize()

template<typename Real>
void OpenMD::SquareMatrix3< Real >::diagonalize ( SquareMatrix3< Real > &  a,
Vector3< Real > &  w,
SquareMatrix3< Real > &  v 
)
static

Extract the eigenvalues and eigenvectors from a 3x3 matrix. The eigenvectors (the columns of V) will be normalized. The eigenvectors are aligned optimally with the x, y, and z axes respectively.

Parameters
asymmetric matrix whose eigenvectors are to be computed. On return, the matrix is overwritten
wwill 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.
Warning
a will be overwritten
Todo:

Definition at line 430 of file SquareMatrix3.hpp.

◆ inverse()

template<typename Real>
SquareMatrix3<Real> OpenMD::SquareMatrix3< Real >::inverse ( ) const
inline

Sets the value of this matrix to the inversion of itself.

Note
since simple algorithm can be applied to inverse the 3 by 3 matrix, we hide the implementation of inverse in SquareMatrix class

Definition at line 338 of file SquareMatrix3.hpp.

Referenced by OpenMD::ApproximationModel::calcHydroPropsAtCD(), OpenMD::ApproximationModel::calcHydroPropsAtCR(), OpenMD::Triangle::computeHydrodynamicTensor(), OpenMD::RNEMD::doVSS(), main(), OpenMD::Velocitizer::removeAngularDrift(), OpenMD::Snapshot::setBoundingBox(), and OpenMD::Snapshot::setHmat().

◆ operator=() [1/2]

template<typename Real>
SquareMatrix3<Real>& OpenMD::SquareMatrix3< Real >::operator= ( const SquareMatrix< Real, 3 > &  m)
inline

copy assignment operator

Definition at line 102 of file SquareMatrix3.hpp.

◆ operator=() [2/2]

template<typename Real>
SquareMatrix3<Real>& OpenMD::SquareMatrix3< Real >::operator= ( const Quaternion< Real > &  q)
inline

Definition at line 110 of file SquareMatrix3.hpp.

◆ setupRotMat() [1/4]

template<typename Real>
void OpenMD::SquareMatrix3< Real >::setupRotMat ( const Vector3< Real > &  eulerAngles)
inline

◆ setupRotMat() [2/4]

template<typename Real>
void OpenMD::SquareMatrix3< Real >::setupRotMat ( Real  phi,
Real  theta,
Real  psi 
)
inline

Sets this matrix to a rotation matrix by three euler angles

Parameters
phi
theta
psi

Definition at line 130 of file SquareMatrix3.hpp.

◆ setupRotMat() [3/4]

template<typename Real>
void OpenMD::SquareMatrix3< Real >::setupRotMat ( const Quaternion< Real > &  quat)
inline

Sets this matrix to a rotation matrix by quaternion

Parameters
quat

Definition at line 159 of file SquareMatrix3.hpp.

◆ setupRotMat() [4/4]

template<typename Real>
void OpenMD::SquareMatrix3< Real >::setupRotMat ( Real  w,
Real  x,
Real  y,
Real  z 
)
inline

Sets this matrix to a rotation matrix by quaternion

Parameters
wthe first element
xthe second element
ythe third element
zthe fourth element

Definition at line 170 of file SquareMatrix3.hpp.

◆ setupSkewMat() [1/2]

◆ setupSkewMat() [2/2]

template<typename Real>
void OpenMD::SquareMatrix3< Real >::setupSkewMat ( Real  v1,
Real  v2,
Real  v3 
)
inline

Definition at line 179 of file SquareMatrix3.hpp.

◆ toEulerAngles()

template<typename Real>
Vector3<Real> OpenMD::SquareMatrix3< Real >::toEulerAngles ( )
inline

Returns the euler angles from this rotation matrix

Returns
the euler angles in a vector
Exceptions
invalidrotation matrix We use so-called "x-convention", which is the most common definition. In this convention, the rotation given by Euler angles (phi, theta, psi), where the first rotation is by an angle phi about the z-axis, the second is by an angle theta (0 <= theta <= 180) about the x-axis, and the third is by an angle psi about the z-axis (again).

Definition at line 269 of file SquareMatrix3.hpp.

Referenced by OpenMD::DirectionalAtom::getGrad(), and OpenMD::RigidBody::getGrad().

◆ toQuaternion()

template<typename Real>
Quaternion<Real> OpenMD::SquareMatrix3< Real >::toQuaternion ( )
inline

Returns the quaternion from this rotation matrix

Returns
the quaternion from this rotation matrix
Exceptions
invalidrotation matrix

Definition at line 213 of file SquareMatrix3.hpp.

Referenced by OpenMD::MolecularRestraint::calcForce(), and OpenMD::ObjectRestraint::calcForce().

◆ trace()

template<typename Real>
Real OpenMD::SquareMatrix3< Real >::trace ( ) const
inline

◆ transpose()


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