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

rectangular matrix class More...

#include "math/DynamicRectMatrix.hpp"

Public Types

typedef Real ElemType
 
typedef Real * ElemPoinerType
 
typedef DynamicRectMatrix< Real > SelfType
 

Public Member Functions

 DynamicRectMatrix ()
 
 DynamicRectMatrix (int nrow, int ncol)
 
 DynamicRectMatrix (int nrow, int ncol, Real s)
 
 DynamicRectMatrix (int nrow, int ncol, Real *array)
 
 DynamicRectMatrix (const SelfType &m)
 
 ~DynamicRectMatrix ()
 
DynamicRectMatrix< Real > operator= (const DynamicRectMatrix< Real > &m)
 
Real & operator() (unsigned int i, unsigned int j)
 
Real operator() (unsigned int i, unsigned int j) const
 
void getArray (Real *array)
 
DynamicVector< Real > getRow (unsigned int row)
 
void setRow (unsigned int row, const DynamicVector< Real > &v)
 
DynamicVector< Real > getColumn (unsigned int col)
 
void setColumn (unsigned int col, const DynamicVector< Real > &v)
 
void swapRow (unsigned int i, unsigned int j)
 
void swapColumn (unsigned int i, unsigned int j)
 
bool operator== (const DynamicRectMatrix< Real > &m)
 
bool operator!= (const DynamicRectMatrix< Real > &m)
 
void negate ()
 
void negate (const DynamicRectMatrix< Real > &m)
 
void add (const DynamicRectMatrix< Real > &m)
 
void add (const DynamicRectMatrix< Real > &m1, const DynamicRectMatrix< Real > &m2)
 
void sub (const DynamicRectMatrix< Real > &m)
 
void sub (const DynamicRectMatrix< Real > &m1, const DynamicRectMatrix< Real > &m2)
 
void mul (Real s)
 
void mul (Real s, const DynamicRectMatrix< Real > &m)
 
void div (Real s)
 
void div (Real s, const DynamicRectMatrix< Real > &m)
 
DynamicRectMatrix< Real > operator*= (const Real s)
 
DynamicRectMatrix< Real > operator/= (const Real s)
 
DynamicRectMatrix< Real > operator+= (const DynamicRectMatrix< Real > m)
 
DynamicRectMatrix< Real > operator-= (const DynamicRectMatrix< Real > m)
 
DynamicRectMatrix< Real > transpose () const
 
unsigned int getNRow () const
 
unsigned int getNCol () 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)
 

Protected Attributes

Real ** data_
 
unsigned int nrow_
 
unsigned int ncol_
 

Private Member Functions

void allocate (int nrow, int ncol)
 
void deallocate ()
 

Detailed Description

template<typename Real>
class OpenMD::DynamicRectMatrix< Real >

rectangular matrix class

Definition at line 62 of file DynamicRectMatrix.hpp.

Member Typedef Documentation

◆ ElemPoinerType

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

Definition at line 65 of file DynamicRectMatrix.hpp.

◆ ElemType

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

Definition at line 64 of file DynamicRectMatrix.hpp.

◆ SelfType

template<typename Real>
typedef DynamicRectMatrix<Real> OpenMD::DynamicRectMatrix< Real >::SelfType

Definition at line 66 of file DynamicRectMatrix.hpp.

Constructor & Destructor Documentation

◆ DynamicRectMatrix() [1/5]

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

default constructor

Definition at line 69 of file DynamicRectMatrix.hpp.

◆ DynamicRectMatrix() [2/5]

template<typename Real>
OpenMD::DynamicRectMatrix< Real >::DynamicRectMatrix ( int  nrow,
int  ncol 
)
inline

Definition at line 75 of file DynamicRectMatrix.hpp.

◆ DynamicRectMatrix() [3/5]

template<typename Real>
OpenMD::DynamicRectMatrix< Real >::DynamicRectMatrix ( int  nrow,
int  ncol,
Real  s 
)
inline

Constructs and initializes every element of this matrix to a scalar

Definition at line 84 of file DynamicRectMatrix.hpp.

◆ DynamicRectMatrix() [4/5]

template<typename Real>
OpenMD::DynamicRectMatrix< Real >::DynamicRectMatrix ( int  nrow,
int  ncol,
Real *  array 
)
inline

Definition at line 91 of file DynamicRectMatrix.hpp.

◆ DynamicRectMatrix() [5/5]

template<typename Real>
OpenMD::DynamicRectMatrix< Real >::DynamicRectMatrix ( const SelfType m)
inline

copy constructor

Definition at line 99 of file DynamicRectMatrix.hpp.

◆ ~DynamicRectMatrix()

template<typename Real>
OpenMD::DynamicRectMatrix< Real >::~DynamicRectMatrix ( )
inline

destructor

Definition at line 108 of file DynamicRectMatrix.hpp.

Member Function Documentation

◆ add() [1/2]

template<typename Real>
void OpenMD::DynamicRectMatrix< Real >::add ( const DynamicRectMatrix< Real > &  m)
inline

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

Parameters
mthe other matrix

Definition at line 279 of file DynamicRectMatrix.hpp.

Referenced by OpenMD::operator+(), and OpenMD::DynamicRectMatrix< RealType >::operator+=().

◆ add() [2/2]

template<typename Real>
void OpenMD::DynamicRectMatrix< Real >::add ( const DynamicRectMatrix< Real > &  m1,
const DynamicRectMatrix< Real > &  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 291 of file DynamicRectMatrix.hpp.

◆ allocate()

template<typename Real>
void OpenMD::DynamicRectMatrix< Real >::allocate ( int  nrow,
int  ncol 
)
inlineprivate

◆ deallocate()

template<typename Real>
void OpenMD::DynamicRectMatrix< Real >::deallocate ( )
inlineprivate

◆ div() [1/2]

template<typename Real>
void OpenMD::DynamicRectMatrix< Real >::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 347 of file DynamicRectMatrix.hpp.

Referenced by OpenMD::operator/(), and OpenMD::DynamicRectMatrix< RealType >::operator/=().

◆ div() [2/2]

template<typename Real>
void OpenMD::DynamicRectMatrix< Real >::div ( Real  s,
const DynamicRectMatrix< Real > &  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 358 of file DynamicRectMatrix.hpp.

◆ getArray()

template<typename Real>
void OpenMD::DynamicRectMatrix< Real >::getArray ( Real *  array)
inline

Copy the internal data to an array

Parameters
arraythe pointer of destination array

Definition at line 150 of file DynamicRectMatrix.hpp.

◆ getColumn()

template<typename Real>
DynamicVector<Real> OpenMD::DynamicRectMatrix< Real >::getColumn ( unsigned int  col)
inline

Returns a column of this matrix as a vector.

Returns
a column of this matrix as a vector
Parameters
colthe column index

Definition at line 188 of file DynamicRectMatrix.hpp.

Referenced by OpenMD::ContactAngle2::doFrame().

◆ getNCol()

◆ getNRow()

◆ getRow()

template<typename Real>
DynamicVector<Real> OpenMD::DynamicRectMatrix< Real >::getRow ( unsigned int  row)
inline

Returns a row of this matrix as a vector.

Returns
a row of this matrix as a vector
Parameters
rowthe row index

Definition at line 163 of file DynamicRectMatrix.hpp.

◆ getSubMatrix()

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

◆ mul() [1/2]

template<typename Real>
void OpenMD::DynamicRectMatrix< Real >::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 325 of file DynamicRectMatrix.hpp.

Referenced by OpenMD::operator*(), and OpenMD::DynamicRectMatrix< RealType >::operator*=().

◆ mul() [2/2]

template<typename Real>
void OpenMD::DynamicRectMatrix< Real >::mul ( Real  s,
const DynamicRectMatrix< Real > &  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 336 of file DynamicRectMatrix.hpp.

◆ negate() [1/2]

template<typename Real>
void OpenMD::DynamicRectMatrix< Real >::negate ( )
inline

Negates the value of this matrix in place.

Definition at line 259 of file DynamicRectMatrix.hpp.

Referenced by OpenMD::operator-().

◆ negate() [2/2]

template<typename Real>
void OpenMD::DynamicRectMatrix< Real >::negate ( const DynamicRectMatrix< Real > &  m)
inline

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

Parameters
mthe source matrix

Definition at line 269 of file DynamicRectMatrix.hpp.

◆ operator!=()

template<typename Real>
bool OpenMD::DynamicRectMatrix< Real >::operator!= ( const DynamicRectMatrix< Real > &  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 254 of file DynamicRectMatrix.hpp.

◆ operator()() [1/2]

template<typename Real>
Real& OpenMD::DynamicRectMatrix< Real >::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 131 of file DynamicRectMatrix.hpp.

◆ operator()() [2/2]

template<typename Real>
Real OpenMD::DynamicRectMatrix< Real >::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 141 of file DynamicRectMatrix.hpp.

◆ operator*=()

template<typename Real>
DynamicRectMatrix<Real> OpenMD::DynamicRectMatrix< Real >::operator*= ( const Real  s)
inline

Multiples a scalar into every element of this matrix.

Parameters
sthe scalar value

Definition at line 369 of file DynamicRectMatrix.hpp.

◆ operator+=()

template<typename Real>
DynamicRectMatrix<Real> OpenMD::DynamicRectMatrix< Real >::operator+= ( const DynamicRectMatrix< Real >  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 387 of file DynamicRectMatrix.hpp.

◆ operator-=()

template<typename Real>
DynamicRectMatrix<Real> OpenMD::DynamicRectMatrix< Real >::operator-= ( const DynamicRectMatrix< Real >  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 397 of file DynamicRectMatrix.hpp.

◆ operator/=()

template<typename Real>
DynamicRectMatrix<Real> OpenMD::DynamicRectMatrix< Real >::operator/= ( const Real  s)
inline

Divides every element of this matrix by a scalar.

Parameters
sthe scalar value

Definition at line 378 of file DynamicRectMatrix.hpp.

◆ operator=()

template<typename Real>
DynamicRectMatrix<Real> OpenMD::DynamicRectMatrix< Real >::operator= ( const DynamicRectMatrix< Real > &  m)
inline

copy assignment operator

Definition at line 111 of file DynamicRectMatrix.hpp.

◆ operator==()

template<typename Real>
bool OpenMD::DynamicRectMatrix< Real >::operator== ( const DynamicRectMatrix< Real > &  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 239 of file DynamicRectMatrix.hpp.

◆ setColumn()

template<typename Real>
void OpenMD::DynamicRectMatrix< Real >::setColumn ( unsigned int  col,
const DynamicVector< Real > &  v 
)
inline

Sets a column of this matrix

Parameters
colthe column index
vthe vector to be set

Definition at line 202 of file DynamicRectMatrix.hpp.

◆ setRow()

template<typename Real>
void OpenMD::DynamicRectMatrix< Real >::setRow ( unsigned int  row,
const DynamicVector< Real > &  v 
)
inline

Sets a row of this matrix

Parameters
rowthe row index
vthe vector to be set

Definition at line 177 of file DynamicRectMatrix.hpp.

◆ setSubMatrix()

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

◆ sub() [1/2]

template<typename Real>
void OpenMD::DynamicRectMatrix< Real >::sub ( const DynamicRectMatrix< Real > &  m)
inline

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

Parameters
mthe other matrix

Definition at line 302 of file DynamicRectMatrix.hpp.

Referenced by OpenMD::operator-(), and OpenMD::DynamicRectMatrix< RealType >::operator-=().

◆ sub() [2/2]

template<typename Real>
void OpenMD::DynamicRectMatrix< Real >::sub ( const DynamicRectMatrix< Real > &  m1,
const DynamicRectMatrix< Real > &  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 314 of file DynamicRectMatrix.hpp.

◆ swapColumn()

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

swap two Columns of this matrix

Parameters
ithe first Column
jthe second Column

Definition at line 225 of file DynamicRectMatrix.hpp.

◆ swapRow()

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

swap two rows of this matrix

Parameters
ithe first row
jthe second row

Definition at line 213 of file DynamicRectMatrix.hpp.

◆ transpose()

template<typename Real>
DynamicRectMatrix<Real> OpenMD::DynamicRectMatrix< Real >::transpose ( ) const
inline

Return the transpose of this matrix

Definition at line 404 of file DynamicRectMatrix.hpp.

Member Data Documentation

◆ data_

◆ ncol_

◆ nrow_


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