MDSTk Libraries  1.1.0
Medical Data Segmentation Toolkit
Public Types | Public Member Functions | Protected Attributes
mds::math::CStaticMatrix< T, M, N > Class Template Reference

Class template for a two dimensional static row-major dense matrix. More...

#include <mdsStaticMatrix.h>

Inheritance diagram for mds::math::CStaticMatrix< T, M, N >:
Inheritance graph
[legend]

List of all members.

Public Types

enum  { CLASS_MATRIX }
 Templates that require members of the CStaticMatrix class can use this enum to check the existence. More...
enum  { SIZE = M * N }
 Size of the matrix data. More...
typedef CMatrixBase
< CStaticMatrix< T, M, N > > 
tBase
 Base class.
typedef T tElement
 Matrix element type.
typedef CStaticMatrix< T, M, NtMatrix
 Matrix type.
typedef Eigen::Matrix
< tElement, M, N,
Eigen::RowMajor > 
tStorage
 Underlying matrix data (see the Eigen math library).

Public Member Functions

CStaticMatrixabs ()
 Makes absolute value of all elements.
tStorageasEigen ()
 Returns reference to the underlying matrix data (see the Eigen math library).
const tStorageasEigen () const
T & at (tSize Row, tSize Col)
 Returns reference to the element [Row][Col].
const T & at (tSize Row, tSize Col) const
 Method returns element (by value) at (row, col).
T & at (tSize i)
 Returns the subscripted pixel.
const T & at (tSize i) const
tSize cols () const
template<typename U >
 CStaticMatrix (const CStaticMatrix< U, M, N > &Matrix)
template<typename Derived >
 CStaticMatrix (const Eigen::MatrixBase< Derived > &Matrix)
 CStaticMatrix ()
 Declare iterator types tIterator and tConstIterator.
template<typename U >
 CStaticMatrix (const CStaticMatrix< U, M, N > &Matrix)
 Copy constructor.
template<typename Derived >
 CStaticMatrix (const Eigen::MatrixBase< Derived > &Matrix)
 Conversion constructor.
 CStaticMatrix (const CStaticMatrix &Matrix)
 Copy constructor specialization.
CStaticMatrixfill (const T &Value)
 Fills the matrix using a given value.
template<class Function >
Function forEach (Function Func)
 Calls a function object for every matrix coefficient.
template<class Function >
Function forEach (Function Func) const
 Calls a function object for every matrix coefficient.
template<class Function >
Function forEach (Function Func)
 Calls a function object for every matrix element.
template<class Function >
Function forEach (Function Func) const
 Calls a function object for every matrix element.
tSize getColOffset () const
 Returns column offset.
T * getColPtr (tSize Col)
 Returns pointer to the first element of matrix column.
const T * getColPtr (tSize Col) const
tSize getIdx (tSize Row, tSize Col) const
 Calculates index of a specified pixel.
tMatrixgetImpl ()
 Returns reference to the matrix implementation.
const tMatrixgetImpl () const
tSize getNumOfCols () const
tSize getNumOfRows () const
 Returns the matrix dimensions.
T * getPtr ()
 Returns pointer to the first matrix element.
const T * getPtr () const
T * getPtr (tSize Row, tSize Col)
 Returns pointer to the given element.
const T * getPtr (tSize Row, tSize Col) const
tSize getRowOffset () const
 Returns row offset.
T * getRowPtr (tSize Row)
 Returns pointer to the first element of matrix row.
const T * getRowPtr (tSize Row) const
bool isSquare () const
 Returns true of the matrix is square.
template<tSize K>
CStaticMatrixmult (const CStaticMatrix< T, M, K > &Matrix1, const CStaticMatrix< T, K, N > &Matrix2)
 Matrix multiplication.
template<tSize K>
CStaticMatrix< T, M, N > & mult (const CStaticMatrix< T, M, K > &m1, const CStaticMatrix< T, K, N > &m2)
CStaticMatrixmultAdd (const CStaticMatrix &Matrix, const T &Scalar)
 Provides operation this += Matrix * Scalar.
CStaticMatrixones ()
 Sets all elements to one.
T & operator() (tSize Row, tSize Col)
 Returns reference to the element [Row][Col].
const T & operator() (tSize Row, tSize Col) const
 Method returns element (by value) at (row, col).
T & operator() (tSize i)
 Returns the subscripted pixel.
const T & operator() (tSize i) const
template<typename U >
CStaticMatrix< T, M, N > & operator*= (const CScalar< U > &c)
CStaticMatrixoperator*= (const CStaticMatrix &Matrix)
 Element wise product.
template<typename U >
CStaticMatrixoperator*= (const CScalar< U > &c)
 Multiplies all elements by scalar.
template<typename U >
CStaticMatrix< T, M, N > & operator+= (const CScalar< U > &c)
CStaticMatrixoperator+= (const CStaticMatrix &Matrix)
 Element wise addition.
template<typename U >
CStaticMatrixoperator+= (const CScalar< U > &c)
 Adds scalar to all elements.
template<typename U >
CStaticMatrix< T, M, N > & operator-= (const CScalar< U > &c)
CStaticMatrixoperator-= (const CStaticMatrix &Matrix)
 Element wise subtraction.
template<typename U >
CStaticMatrixoperator-= (const CScalar< U > &c)
 Subtracts scalar to all elements.
template<typename U >
CStaticMatrix< T, M, N > & operator/= (const CScalar< U > &c)
CStaticMatrixoperator/= (const CStaticMatrix &Matrix)
 Element wise addition.
template<typename U >
CStaticMatrixoperator/= (const CScalar< U > &c)
 Divides all elements by scalar.
template<typename U >
CStaticMatrix< T, M, N > & operator= (const CStaticMatrix< U, M, N > &Matrix)
template<typename Derived >
CStaticMatrix< T, M, N > & operator= (const Eigen::MatrixBase< Derived > &Matrix)
template<typename U >
CStaticMatrixoperator= (const CStaticMatrix< U, M, N > &Matrix)
 Assignment operator.
template<typename Derived >
CStaticMatrixoperator= (const Eigen::MatrixBase< Derived > &Matrix)
 Assignment operator.
CStaticMatrixoperator= (const CStaticMatrix &Matrix)
 Assignment operator specialization.
template<class Function >
Function pforEach (Function Func)
 Calls a function object for every matrix coefficient.
template<class Function >
Function pforEach (Function Func)
 Calls a function object for every matrix element.
template<class Function >
Function pforEach (Function Func) const
 Calls a function object for every matrix coefficient.
template<class Function >
Function pforEach (Function Func) const
 Calls a function object for every matrix element.
tSize rows () const
 Returns the matrix dimensions.
tMatrixset (tSize row, tSize col, const tElement &Value)
 Method sets value of element at (row, col).
CStaticMatrixset (tSize Row, tSize Col, const T &Value)
 Sets the element of matrix at the position [Row][Col].
tMatrixset (tSize i, const tElement &Value)
 Sets the subscripted matrix coefficient.
CStaticMatrixset (tSize i, const T &Value)
 Sets the subscripted voxel.
CStaticMatrixtranspose (const CStaticMatrix< T, N, M > &Matrix)
 Makes this to be transpose of a given matrix.
CStaticMatrixunit ()
 Makes the matrix unit.
CStaticMatrixzeros ()
 Zeros the matrix.
 ~CStaticMatrix ()
 Destructor.

Protected Attributes

tStorage m_Matrix
 Underlying matrix data (see the Eigen math library).

Detailed Description

template<typename T, tSize M, tSize N>
class mds::math::CStaticMatrix< T, M, N >

Class template for a two dimensional static row-major dense matrix.


Member Typedef Documentation

template<typename T, tSize M, tSize N>
typedef CMatrixBase<CStaticMatrix<T, M, N> > mds::math::CStaticMatrix< T, M, N >::tBase

Base class.

template<typename T, tSize M, tSize N>
typedef T mds::math::CStaticMatrix< T, M, N >::tElement

Matrix element type.

Reimplemented from mds::math::CMatrixBase< CStaticMatrix< T, M, N > >.

typedef CStaticMatrix< T, M, N > mds::math::CMatrixBase< CStaticMatrix< T, M, N > >::tMatrix [inherited]

Matrix type.

template<typename T, tSize M, tSize N>
typedef Eigen::Matrix<tElement, M, N, Eigen::RowMajor> mds::math::CStaticMatrix< T, M, N >::tStorage

Underlying matrix data (see the Eigen math library).


Member Enumeration Documentation

template<typename T, tSize M, tSize N>
anonymous enum

Templates that require members of the CStaticMatrix class can use this enum to check the existence.

Enumerator:
CLASS_MATRIX 
template<typename T, tSize M, tSize N>
anonymous enum

Size of the matrix data.

Enumerator:
SIZE 

Constructor & Destructor Documentation

template<typename T , tSize M, tSize N>
CStaticMatrix::CStaticMatrix ( )

Declare iterator types tIterator and tConstIterator.

Constructor.

template<typename T , tSize M, tSize N>
template<typename U >
mds::math::CStaticMatrix< T, M, N >::CStaticMatrix ( const CStaticMatrix< U, M, N > &  Matrix)

Copy constructor.

template<typename T , tSize M, tSize N>
template<typename Derived >
mds::math::CStaticMatrix< T, M, N >::CStaticMatrix ( const Eigen::MatrixBase< Derived > &  Matrix)

Conversion constructor.

template<typename T , tSize M, tSize N>
mds::math::CStaticMatrix< T, M, N >::CStaticMatrix ( const CStaticMatrix< T, M, N > &  Matrix)

Copy constructor specialization.

template<typename T, tSize M, tSize N>
mds::math::CStaticMatrix< T, M, N >::~CStaticMatrix ( )

Destructor.

template<typename T, tSize M, tSize N>
template<typename U >
mds::math::CStaticMatrix< T, M, N >::CStaticMatrix ( const CStaticMatrix< U, M, N > &  Matrix)
template<typename T, tSize M, tSize N>
template<typename Derived >
mds::math::CStaticMatrix< T, M, N >::CStaticMatrix ( const Eigen::MatrixBase< Derived > &  Matrix)

Member Function Documentation

template<typename T , tSize M, tSize N>
CStaticMatrix< T, M, N > & CStaticMatrix::abs ( )

Makes absolute value of all elements.

  • Returns reference to this.
template<typename T, tSize M, tSize N>
tStorage& mds::math::CStaticMatrix< T, M, N >::asEigen ( )

Returns reference to the underlying matrix data (see the Eigen math library).

template<typename T, tSize M, tSize N>
const tStorage& mds::math::CStaticMatrix< T, M, N >::asEigen ( ) const
template<typename T, tSize M, tSize N>
T& mds::math::CStaticMatrix< T, M, N >::at ( tSize  Row,
tSize  Col 
)

Returns reference to the element [Row][Col].

Reimplemented from mds::math::CMatrixBase< CStaticMatrix< T, M, N > >.

template<typename T, tSize M, tSize N>
const T& mds::math::CStaticMatrix< T, M, N >::at ( tSize  row,
tSize  col 
) const

Method returns element (by value) at (row, col).

Reimplemented from mds::math::CMatrixBase< CStaticMatrix< T, M, N > >.

template<typename T, tSize M, tSize N>
T& mds::math::CStaticMatrix< T, M, N >::at ( tSize  i)

Returns the subscripted pixel.

Reimplemented from mds::math::CMatrixBase< CStaticMatrix< T, M, N > >.

template<typename T, tSize M, tSize N>
const T& mds::math::CStaticMatrix< T, M, N >::at ( tSize  i) const
template<typename T, tSize M, tSize N>
tSize mds::math::CStaticMatrix< T, M, N >::cols ( ) const
template<typename T, tSize M, tSize N>
CStaticMatrix< T, M, N > & CStaticMatrix::fill ( const T &  Value)

Fills the matrix using a given value.

  • Returns reference to this.
template<typename T, tSize M, tSize N>
template<class Function >
Function mds::math::CStaticMatrix< T, M, N >::forEach ( Function  Func)

Calls a function object for every matrix coefficient.

Reimplemented from mds::math::CMatrixBase< CStaticMatrix< T, M, N > >.

template<typename T, tSize M, tSize N>
template<class Function >
Function mds::math::CStaticMatrix< T, M, N >::forEach ( Function  Func) const

Calls a function object for every matrix coefficient.

Reimplemented from mds::math::CMatrixBase< CStaticMatrix< T, M, N > >.

template<typename T , tSize M, tSize N>
template<class Function >
Function mds::math::CStaticMatrix< T, M, N >::forEach ( Function  Func)

Calls a function object for every matrix element.

Reimplemented from mds::math::CMatrixBase< CStaticMatrix< T, M, N > >.

template<typename T , tSize M, tSize N>
template<class Function >
Function mds::math::CStaticMatrix< T, M, N >::forEach ( Function  Func) const

Calls a function object for every matrix element.

Reimplemented from mds::math::CMatrixBase< CStaticMatrix< T, M, N > >.

template<typename T, tSize M, tSize N>
tSize mds::math::CStaticMatrix< T, M, N >::getColOffset ( ) const

Returns column offset.

In other words, offset between two neighbouring elements in a matrix row.

Reimplemented from mds::math::CMatrixBase< CStaticMatrix< T, M, N > >.

template<typename T, tSize M, tSize N>
T* mds::math::CStaticMatrix< T, M, N >::getColPtr ( tSize  Col)

Returns pointer to the first element of matrix column.

template<typename T, tSize M, tSize N>
const T* mds::math::CStaticMatrix< T, M, N >::getColPtr ( tSize  Col) const
template<typename T, tSize M, tSize N>
tSize mds::math::CStaticMatrix< T, M, N >::getIdx ( tSize  Row,
tSize  Col 
) const

Calculates index of a specified pixel.

Reimplemented from mds::math::CMatrixBase< CStaticMatrix< T, M, N > >.

tMatrix& mds::math::CMatrixBase< CStaticMatrix< T, M, N > >::getImpl ( ) [inherited]

Returns reference to the matrix implementation.

const tMatrix& mds::math::CMatrixBase< CStaticMatrix< T, M, N > >::getImpl ( ) const [inherited]
template<typename T, tSize M, tSize N>
tSize mds::math::CStaticMatrix< T, M, N >::getNumOfCols ( ) const
template<typename T, tSize M, tSize N>
tSize mds::math::CStaticMatrix< T, M, N >::getNumOfRows ( ) const

Returns the matrix dimensions.

Reimplemented from mds::math::CMatrixBase< CStaticMatrix< T, M, N > >.

template<typename T, tSize M, tSize N>
T* mds::math::CStaticMatrix< T, M, N >::getPtr ( )

Returns pointer to the first matrix element.

template<typename T, tSize M, tSize N>
const T* mds::math::CStaticMatrix< T, M, N >::getPtr ( ) const
template<typename T, tSize M, tSize N>
T* mds::math::CStaticMatrix< T, M, N >::getPtr ( tSize  Row,
tSize  Col 
)

Returns pointer to the given element.

template<typename T, tSize M, tSize N>
const T* mds::math::CStaticMatrix< T, M, N >::getPtr ( tSize  Row,
tSize  Col 
) const
template<typename T, tSize M, tSize N>
tSize mds::math::CStaticMatrix< T, M, N >::getRowOffset ( ) const

Returns row offset.

In other words, offset between two neighbouring elements in a matrix column.

Reimplemented from mds::math::CMatrixBase< CStaticMatrix< T, M, N > >.

template<typename T, tSize M, tSize N>
T* mds::math::CStaticMatrix< T, M, N >::getRowPtr ( tSize  Row)

Returns pointer to the first element of matrix row.

template<typename T, tSize M, tSize N>
const T* mds::math::CStaticMatrix< T, M, N >::getRowPtr ( tSize  Row) const
template<typename T, tSize M, tSize N>
bool mds::math::CStaticMatrix< T, M, N >::isSquare ( ) const

Returns true of the matrix is square.

template<typename T, tSize M, tSize N>
template<tSize K>
CStaticMatrix< T, M, N > & mds::math::CStaticMatrix< T, M, N >::mult ( const CStaticMatrix< T, M, K > &  Matrix1,
const CStaticMatrix< T, K, N > &  Matrix2 
)

Matrix multiplication.

  • Returns reference to this.
template<typename T, tSize M, tSize N>
template<tSize K>
CStaticMatrix<T,M,N>& mds::math::CStaticMatrix< T, M, N >::mult ( const CStaticMatrix< T, M, K > &  m1,
const CStaticMatrix< T, K, N > &  m2 
)
template<typename T, tSize M, tSize N>
CStaticMatrix< T, M, N > & CStaticMatrix::multAdd ( const CStaticMatrix< T, M, N > &  Matrix,
const T &  Scalar 
)

Provides operation this += Matrix * Scalar.

  • Returns reference to this.
template<typename T , tSize M, tSize N>
CStaticMatrix< T, M, N > & CStaticMatrix::ones ( )

Sets all elements to one.

  • Returns reference to this.
template<typename T, tSize M, tSize N>
T& mds::math::CStaticMatrix< T, M, N >::operator() ( tSize  Row,
tSize  Col 
)

Returns reference to the element [Row][Col].

Reimplemented from mds::math::CMatrixBase< CStaticMatrix< T, M, N > >.

template<typename T, tSize M, tSize N>
const T& mds::math::CStaticMatrix< T, M, N >::operator() ( tSize  row,
tSize  col 
) const

Method returns element (by value) at (row, col).

Reimplemented from mds::math::CMatrixBase< CStaticMatrix< T, M, N > >.

template<typename T, tSize M, tSize N>
T& mds::math::CStaticMatrix< T, M, N >::operator() ( tSize  i)

Returns the subscripted pixel.

Reimplemented from mds::math::CMatrixBase< CStaticMatrix< T, M, N > >.

template<typename T, tSize M, tSize N>
const T& mds::math::CStaticMatrix< T, M, N >::operator() ( tSize  i) const
template<typename T, tSize M, tSize N>
template<typename U >
CStaticMatrix<T,M,N>& mds::math::CStaticMatrix< T, M, N >::operator*= ( const CScalar< U > &  c)
template<typename T , tSize M, tSize N>
CStaticMatrix< T, M, N > & mds::math::CStaticMatrix< T, M, N >::operator*= ( const CStaticMatrix< T, M, N > &  Matrix)

Element wise product.

template<typename T , tSize M, tSize N>
template<typename U >
CStaticMatrix< T, M, N > & mds::math::CStaticMatrix< T, M, N >::operator*= ( const CScalar< U > &  c)

Multiplies all elements by scalar.

template<typename T, tSize M, tSize N>
template<typename U >
CStaticMatrix<T,M,N>& mds::math::CStaticMatrix< T, M, N >::operator+= ( const CScalar< U > &  c)
template<typename T , tSize M, tSize N>
CStaticMatrix< T, M, N > & mds::math::CStaticMatrix< T, M, N >::operator+= ( const CStaticMatrix< T, M, N > &  Matrix)

Element wise addition.

template<typename T , tSize M, tSize N>
template<typename U >
CStaticMatrix< T, M, N > & mds::math::CStaticMatrix< T, M, N >::operator+= ( const CScalar< U > &  c)

Adds scalar to all elements.

template<typename T, tSize M, tSize N>
template<typename U >
CStaticMatrix<T,M,N>& mds::math::CStaticMatrix< T, M, N >::operator-= ( const CScalar< U > &  c)
template<typename T , tSize M, tSize N>
CStaticMatrix< T, M, N > & mds::math::CStaticMatrix< T, M, N >::operator-= ( const CStaticMatrix< T, M, N > &  Matrix)

Element wise subtraction.

template<typename T , tSize M, tSize N>
template<typename U >
CStaticMatrix< T, M, N > & mds::math::CStaticMatrix< T, M, N >::operator-= ( const CScalar< U > &  c)

Subtracts scalar to all elements.

template<typename T, tSize M, tSize N>
template<typename U >
CStaticMatrix<T,M,N>& mds::math::CStaticMatrix< T, M, N >::operator/= ( const CScalar< U > &  c)
template<typename T , tSize M, tSize N>
CStaticMatrix< T, M, N > & mds::math::CStaticMatrix< T, M, N >::operator/= ( const CStaticMatrix< T, M, N > &  Matrix)

Element wise addition.

template<typename T , tSize M, tSize N>
template<typename U >
CStaticMatrix< T, M, N > & mds::math::CStaticMatrix< T, M, N >::operator/= ( const CScalar< U > &  c)

Divides all elements by scalar.

template<typename T, tSize M, tSize N>
template<typename U >
CStaticMatrix<T,M,N>& mds::math::CStaticMatrix< T, M, N >::operator= ( const CStaticMatrix< U, M, N > &  Matrix)
template<typename T, tSize M, tSize N>
template<typename Derived >
CStaticMatrix<T,M,N>& mds::math::CStaticMatrix< T, M, N >::operator= ( const Eigen::MatrixBase< Derived > &  Matrix)
template<typename T , tSize M, tSize N>
template<typename U >
CStaticMatrix< T, M, N > & mds::math::CStaticMatrix< T, M, N >::operator= ( const CStaticMatrix< U, M, N > &  Matrix)

Assignment operator.

template<typename T , tSize M, tSize N>
template<typename Derived >
CStaticMatrix< T, M, N > & mds::math::CStaticMatrix< T, M, N >::operator= ( const Eigen::MatrixBase< Derived > &  Matrix)

Assignment operator.

template<typename T , tSize M, tSize N>
CStaticMatrix< T, M, N > & mds::math::CStaticMatrix< T, M, N >::operator= ( const CStaticMatrix< T, M, N > &  Matrix)

Assignment operator specialization.

template<typename T, tSize M, tSize N>
template<class Function >
Function mds::math::CStaticMatrix< T, M, N >::pforEach ( Function  Func)

Calls a function object for every matrix coefficient.

  • Parallel version.

Reimplemented from mds::math::CMatrixBase< CStaticMatrix< T, M, N > >.

template<typename T , tSize M, tSize N>
template<class Function >
Function mds::math::CStaticMatrix< T, M, N >::pforEach ( Function  Func)

Calls a function object for every matrix element.

  • Parallel version.

Reimplemented from mds::math::CMatrixBase< CStaticMatrix< T, M, N > >.

template<typename T, tSize M, tSize N>
template<class Function >
Function mds::math::CStaticMatrix< T, M, N >::pforEach ( Function  Func) const

Calls a function object for every matrix coefficient.

  • Parallel version.

Reimplemented from mds::math::CMatrixBase< CStaticMatrix< T, M, N > >.

template<typename T , tSize M, tSize N>
template<class Function >
Function mds::math::CStaticMatrix< T, M, N >::pforEach ( Function  Func) const

Calls a function object for every matrix element.

  • Parallel version.

Reimplemented from mds::math::CMatrixBase< CStaticMatrix< T, M, N > >.

template<typename T, tSize M, tSize N>
tSize mds::math::CStaticMatrix< T, M, N >::rows ( ) const

Returns the matrix dimensions.

Reimplemented from mds::math::CMatrixBase< CStaticMatrix< T, M, N > >.

tMatrix& mds::math::CMatrixBase< CStaticMatrix< T, M, N > >::set ( tSize  row,
tSize  col,
const tElement Value 
) [inherited]

Method sets value of element at (row, col).

template<typename T, tSize M, tSize N>
CStaticMatrix& mds::math::CStaticMatrix< T, M, N >::set ( tSize  Row,
tSize  Col,
const T &  Value 
)

Sets the element of matrix at the position [Row][Col].

tMatrix& mds::math::CMatrixBase< CStaticMatrix< T, M, N > >::set ( tSize  i,
const tElement Value 
) [inherited]

Sets the subscripted matrix coefficient.

template<typename T, tSize M, tSize N>
CStaticMatrix& mds::math::CStaticMatrix< T, M, N >::set ( tSize  i,
const T &  Value 
)

Sets the subscripted voxel.

template<typename T, tSize M, tSize N>
CStaticMatrix< T, M, N > & CStaticMatrix::transpose ( const CStaticMatrix< T, N, M > &  Matrix)

Makes this to be transpose of a given matrix.

  • Returns reference to this.
template<typename T , tSize M, tSize N>
CStaticMatrix< T, M, N > & CStaticMatrix::unit ( )

Makes the matrix unit.

  • Returns reference to this.
template<typename T , tSize M, tSize N>
CStaticMatrix< T, M, N > & CStaticMatrix::zeros ( )

Zeros the matrix.

  • Returns reference to this.

Member Data Documentation

template<typename T, tSize M, tSize N>
tStorage mds::math::CStaticMatrix< T, M, N >::m_Matrix [protected]

Underlying matrix data (see the Eigen math library).


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