OpenMD  2.5
Molecular Dynamics in the Open
OpenMD::RectMatrix< Real, Row, Col > Class Template Reference

rectangular matrix class More...

#include "math/RectMatrix.hpp"

Public Types

typedef Real ElemType
 
typedef Real * ElemPoinerType
 

Public Member Functions

 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, RowgetRow (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, Rowtranspose () 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)
 
unsigned int getNRow () const
 
unsigned int getNCol () const
 

Protected Attributes

Real data_ [Row][Col]
 

Detailed Description

template<typename Real, unsigned int Row, unsigned int Col>
class OpenMD::RectMatrix< Real, Row, Col >

rectangular matrix class

Definition at line 62 of file RectMatrix.hpp.

Member Typedef Documentation

◆ ElemPoinerType

template<typename Real, unsigned int Row, unsigned int Col>
typedef Real* OpenMD::RectMatrix< Real, Row, Col >::ElemPoinerType

Definition at line 65 of file RectMatrix.hpp.

◆ ElemType

template<typename Real, unsigned int Row, unsigned int Col>
typedef Real OpenMD::RectMatrix< Real, Row, Col >::ElemType

Definition at line 64 of file RectMatrix.hpp.

Constructor & Destructor Documentation

◆ RectMatrix() [1/4]

template<typename Real, unsigned int Row, unsigned int Col>
OpenMD::RectMatrix< Real, Row, Col >::RectMatrix ( )
inline

default constructor

Definition at line 68 of file RectMatrix.hpp.

◆ RectMatrix() [2/4]

template<typename Real, unsigned int Row, unsigned int Col>
OpenMD::RectMatrix< Real, Row, Col >::RectMatrix ( Real  s)
inline

Constructs and initializes every element of this matrix to a scalar

Definition at line 75 of file RectMatrix.hpp.

◆ RectMatrix() [3/4]

template<typename Real, unsigned int Row, unsigned int Col>
OpenMD::RectMatrix< Real, Row, Col >::RectMatrix ( Real *  array)
inline

Definition at line 81 of file RectMatrix.hpp.

◆ RectMatrix() [4/4]

template<typename Real, unsigned int Row, unsigned int Col>
OpenMD::RectMatrix< Real, Row, Col >::RectMatrix ( const RectMatrix< Real, Row, Col > &  m)
inline

copy constructor

Definition at line 88 of file RectMatrix.hpp.

◆ ~RectMatrix()

template<typename Real, unsigned int Row, unsigned int Col>
OpenMD::RectMatrix< Real, Row, Col >::~RectMatrix ( )
inline

destructor

Definition at line 93 of file RectMatrix.hpp.

Member Function Documentation

◆ add() [1/2]

template<typename Real, unsigned int Row, unsigned int Col>
void OpenMD::RectMatrix< Real, Row, Col >::add ( const RectMatrix< Real, Row, Col > &  m)
inline

Sets the value of this matrix to the sum of itself and m (*this += m).

Parameters
mthe other matrix

Definition at line 266 of file RectMatrix.hpp.

Referenced by OpenMD::operator+(), and OpenMD::RectMatrix< Real, Dim, Dim >::operator+=().

◆ add() [2/2]

template<typename Real, unsigned int Row, unsigned int Col>
void OpenMD::RectMatrix< Real, Row, Col >::add ( const RectMatrix< Real, Row, Col > &  m1,
const RectMatrix< Real, Row, Col > &  m2 
)
inline

Sets the value of this matrix to the sum of m1 and m2 (*this = m1 + m2).

Parameters
m1the first matrix
m2the second matrix

Definition at line 277 of file RectMatrix.hpp.

◆ div() [1/2]

template<typename Real, unsigned int Row, unsigned int Col>
void OpenMD::RectMatrix< Real, Row, Col >::div ( Real  s)
inline

Sets the value of this matrix to the scalar division of itself (*this /= s ).

Parameters
sthe scalar value

Definition at line 329 of file RectMatrix.hpp.

Referenced by OpenMD::operator/(), and OpenMD::RectMatrix< Real, Dim, Dim >::operator/=().

◆ div() [2/2]

template<typename Real, unsigned int Row, unsigned int Col>
void OpenMD::RectMatrix< Real, Row, Col >::div ( Real  s,
const RectMatrix< Real, Row, Col > &  m 
)
inline

Sets the value of this matrix to the scalar division of matrix m (*this = m /s).

Parameters
sthe scalar value
mthe matrix

Definition at line 340 of file RectMatrix.hpp.

◆ getArray()

template<typename Real, unsigned int Row, unsigned int Col>
void OpenMD::RectMatrix< Real, Row, Col >::getArray ( Real *  array)
inline

Copy the internal data to an array

Parameters
arraythe pointer of destination array

Definition at line 132 of file RectMatrix.hpp.

◆ getArrayPointer()

template<typename Real, unsigned int Row, unsigned int Col>
Real* OpenMD::RectMatrix< Real, Row, Col >::getArrayPointer ( )
inline

◆ getColumn()

template<typename Real, unsigned int Row, unsigned int Col>
Vector<Real, Col> OpenMD::RectMatrix< Real, Row, Col >::getColumn ( unsigned int  col)
inline

◆ getNCol()

template<typename Real, unsigned int Row, unsigned int Col>
unsigned int OpenMD::RectMatrix< Real, Row, Col >::getNCol ( ) const
inline

◆ getNRow()

template<typename Real, unsigned int Row, unsigned int Col>
unsigned int OpenMD::RectMatrix< Real, Row, Col >::getNRow ( ) const
inline

◆ getRow()

template<typename Real, unsigned int Row, unsigned int Col>
Vector<Real, Row> OpenMD::RectMatrix< Real, Row, Col >::getRow ( unsigned int  row)
inline

◆ getSubMatrix()

template<typename Real, unsigned int Row, unsigned int Col>
template<class MatrixType >
void OpenMD::RectMatrix< Real, Row, Col >::getSubMatrix ( unsigned int  beginRow,
unsigned int  beginCol,
MatrixType &  m 
)
inline

◆ mul() [1/2]

template<typename Real, unsigned int Row, unsigned int Col>
void OpenMD::RectMatrix< Real, Row, Col >::mul ( Real  s)
inline

Sets the value of this matrix to the scalar multiplication of itself (*this *= s).

Parameters
sthe scalar value

Definition at line 308 of file RectMatrix.hpp.

Referenced by OpenMD::operator*(), and OpenMD::RectMatrix< Real, Dim, Dim >::operator*=().

◆ mul() [2/2]

template<typename Real, unsigned int Row, unsigned int Col>
void OpenMD::RectMatrix< Real, Row, Col >::mul ( Real  s,
const RectMatrix< Real, Row, Col > &  m 
)
inline

Sets the value of this matrix to the scalar multiplication of matrix m (*this = s * m).

Parameters
sthe scalar value
mthe matrix

Definition at line 319 of file RectMatrix.hpp.

◆ negate() [1/2]

template<typename Real, unsigned int Row, unsigned int Col>
void OpenMD::RectMatrix< Real, Row, Col >::negate ( )
inline

Negates the value of this matrix in place.

Definition at line 246 of file RectMatrix.hpp.

Referenced by OpenMD::operator-().

◆ negate() [2/2]

template<typename Real, unsigned int Row, unsigned int Col>
void OpenMD::RectMatrix< Real, Row, Col >::negate ( const RectMatrix< Real, Row, Col > &  m)
inline

Sets the value of this matrix to the negation of matrix m.

Parameters
mthe source matrix

Definition at line 256 of file RectMatrix.hpp.

◆ operator!=()

template<typename Real, unsigned int Row, unsigned int Col>
bool OpenMD::RectMatrix< Real, Row, Col >::operator!= ( const RectMatrix< Real, Row, Col > &  m)
inline

Tests if this matrix is not equal to matrix m

Returns
true if this matrix is not equal to the matrix m, return false otherwise
Parameters
mmatrix to be compared

Definition at line 241 of file RectMatrix.hpp.

◆ operator()() [1/2]

template<typename Real, unsigned int Row, unsigned int Col>
Real& OpenMD::RectMatrix< Real, Row, Col >::operator() ( unsigned int  i,
unsigned int  j 
)
inline

Return the reference of a single element of this matrix.

Returns
the reference of a single element of this matrix
Parameters
irow index
jColumn index

Definition at line 112 of file RectMatrix.hpp.

◆ operator()() [2/2]

template<typename Real, unsigned int Row, unsigned int Col>
Real OpenMD::RectMatrix< Real, Row, Col >::operator() ( unsigned int  i,
unsigned int  j 
) const
inline

Return the value of a single element of this matrix.

Returns
the value of a single element of this matrix
Parameters
irow index
jColumn index

Definition at line 123 of file RectMatrix.hpp.

◆ operator*=()

template<typename Real, unsigned int Row, unsigned int Col>
RectMatrix<Real, Row, Col>& OpenMD::RectMatrix< Real, Row, Col >::operator*= ( const Real  s)
inline

Multiples a scalar into every element of this matrix.

Parameters
sthe scalar value

Definition at line 350 of file RectMatrix.hpp.

◆ operator+=()

template<typename Real, unsigned int Row, unsigned int Col>
RectMatrix<Real, Row, Col>& OpenMD::RectMatrix< Real, Row, Col >::operator+= ( const RectMatrix< Real, Row, Col > &  m)
inline

Sets the value of this matrix to the sum of the other matrix and itself (*this += m).

Parameters
mthe other matrix

Definition at line 368 of file RectMatrix.hpp.

◆ operator-=()

template<typename Real, unsigned int Row, unsigned int Col>
RectMatrix<Real, Row, Col>& OpenMD::RectMatrix< Real, Row, Col >::operator-= ( const RectMatrix< Real, Row, Col > &  m)
inline

Sets the value of this matrix to the differerence of itself and the other matrix (*this -= m)

Parameters
mthe other matrix

Definition at line 377 of file RectMatrix.hpp.

◆ operator/=()

template<typename Real, unsigned int Row, unsigned int Col>
RectMatrix<Real, Row, Col>& OpenMD::RectMatrix< Real, Row, Col >::operator/= ( const Real  s)
inline

Divides every element of this matrix by a scalar.

Parameters
sthe scalar value

Definition at line 359 of file RectMatrix.hpp.

◆ operator=()

template<typename Real, unsigned int Row, unsigned int Col>
RectMatrix<Real, Row, Col>& OpenMD::RectMatrix< Real, Row, Col >::operator= ( const RectMatrix< Real, Row, Col > &  m)
inline

copy assignment operator

Definition at line 96 of file RectMatrix.hpp.

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

◆ operator==()

template<typename Real, unsigned int Row, unsigned int Col>
bool OpenMD::RectMatrix< Real, Row, Col >::operator== ( const RectMatrix< Real, Row, Col > &  m)
inline

Tests if this matrix is identical to matrix m

Returns
true if this matrix is equal to the matrix m, return false otherwise
Parameters
mmatrix to be compared
Todo:
replace operator == by template function equal

Definition at line 227 of file RectMatrix.hpp.

◆ setColumn()

template<typename Real, unsigned int Row, unsigned int Col>
void OpenMD::RectMatrix< Real, Row, Col >::setColumn ( unsigned int  col,
const Vector< Real, Col > &  v 
)
inline

Sets a column of this matrix

Parameters
colthe column index
vthe vector to be set

Definition at line 190 of file RectMatrix.hpp.

◆ setRow()

template<typename Real, unsigned int Row, unsigned int Col>
void OpenMD::RectMatrix< Real, Row, Col >::setRow ( unsigned int  row,
const Vector< Real, Row > &  v 
)
inline

Sets a row of this matrix

Parameters
rowthe row index
vthe vector to be set

Definition at line 165 of file RectMatrix.hpp.

Referenced by OpenMD::GofXyz::initializeHistogram(), and OpenMD::LipidTransVisitor::update().

◆ setSubMatrix()

template<typename Real, unsigned int Row, unsigned int Col>
template<class MatrixType >
void OpenMD::RectMatrix< Real, Row, Col >::setSubMatrix ( unsigned int  beginRow,
unsigned int  beginCol,
const MatrixType &  m 
)
inline

◆ sub() [1/2]

template<typename Real, unsigned int Row, unsigned int Col>
void OpenMD::RectMatrix< Real, Row, Col >::sub ( const RectMatrix< Real, Row, Col > &  m)
inline

Sets the value of this matrix to the difference of itself and m (*this -= m).

Parameters
mthe other matrix

Definition at line 287 of file RectMatrix.hpp.

Referenced by OpenMD::operator-(), and OpenMD::RectMatrix< Real, Dim, Dim >::operator-=().

◆ sub() [2/2]

template<typename Real, unsigned int Row, unsigned int Col>
void OpenMD::RectMatrix< Real, Row, Col >::sub ( const RectMatrix< Real, Row, Col > &  m1,
const RectMatrix< Real, Row, Col > &  m2 
)
inline

Sets the value of this matrix to the difference of matrix m1 and m2 (*this = m1 - m2).

Parameters
m1the first matrix
m2the second matrix

Definition at line 298 of file RectMatrix.hpp.

◆ swapColumn()

template<typename Real, unsigned int Row, unsigned int Col>
void OpenMD::RectMatrix< Real, Row, Col >::swapColumn ( unsigned int  i,
unsigned int  j 
)
inline

swap two Columns of this matrix

Parameters
ithe first Column
jthe second Column

Definition at line 213 of file RectMatrix.hpp.

◆ swapRow()

template<typename Real, unsigned int Row, unsigned int Col>
void OpenMD::RectMatrix< Real, Row, Col >::swapRow ( unsigned int  i,
unsigned int  j 
)
inline

swap two rows of this matrix

Parameters
ithe first row
jthe second row

Definition at line 201 of file RectMatrix.hpp.

◆ transpose()

template<typename Real, unsigned int Row, unsigned int Col>
RectMatrix<Real, Col, Row> OpenMD::RectMatrix< Real, Row, Col >::transpose ( ) const
inline

Return the transpose of this matrix

Definition at line 383 of file RectMatrix.hpp.

Member Data Documentation

◆ data_


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