MeVisLab Toolbox Reference
ml::Tmat3< DT > Class Template Reference

A three by three matrix class of three row vectors. More...

#include <mlMatrix3.h>

Inheritance diagram for ml::Tmat3< DT >:
ml::FloatingPointMatrix< Tvec3< DT >, 3 >

Public Types

typedef DT ComponentType
 A typedef to "export" the type of components. More...
 
- Public Types inherited from ml::FloatingPointMatrix< Tvec3< DT >, 3 >
enum  
 This enum grants access to the row count during compile time, e.g. More...
 
enum  
 This enum grants access to the row count during compile time, e.g. More...
 
enum  
 This enum grants access to the number of values in the matrix, e.g. More...
 
typedef VectorT::ComponentType ComponentType
 A typedef to "export" the type of sub-components. More...
 
typedef Tvec3< DT > VectorType
 A typedef to "export" the type of component vector. More...
 

Public Member Functions

bool operator< (const Tmat3< DT > &) const
 Dummy "lesser than operator" which always returns false. More...
 
Tmat3 Constructor, set and get functionality.
 Tmat3 (const double in00, const double in01, const double in02, const double in10, const double in11, const double in12, const double in20, const double in21, const double in22)
 Initializes all matrix elements explicitly with scalars, filling it row by row. More...
 
void setValues (const float mat[9])
 Copies the contents of mat into *this, row by row. More...
 
void getValues (float mat[9]) const
 Copies the contents of *this into mat, row by row. More...
 
void setValues (const double mat[9])
 Copies the contents of mat into *this, row by row. More...
 
void getValues (double mat[9]) const
 Copies the contents of *this into mat, row by row. More...
 
void setScaleMatrix (const DT scale)
 Sets a diagonal matrix with scale on diagonal. More...
 
- Public Member Functions inherited from ml::FloatingPointMatrix< Tvec3< DT >, 3 >
const Tvec3< DT > & operator[] (const size_t i) const
 
Tvec3< DT > & operator[] (const size_t i)
 
ComponentTypelinearIndexed (const size_t idx)
 
ComponentType linearIndexedConst (const size_t idx) const
 
ComponentType compAbsSum () const
 
void setValuesFromPtr (const ComponentType *const values)
 Copies contents from array mat into *this, row by row; type and size must match. More...
 
void getValuesToPtr (ComponentType *values) const
 Copies contents of *this into array mat, row by row; type and size must match. More...
 

Constructors, set and get functionality.

 Tmat3 ()
 Builds a 3x3 matrix from 9 0 elements. More...
 
 Tmat3 (const DT diagValue)
 
 Tmat3 (const Tvec3< DT > &row0, const Tvec3< DT > &row1, const Tvec3< DT > &row2)
 Builds a matrix of the three row vectors row0, row1, row2. More...
 
 Tmat3 (const Tmat3< DT > &mat)
 Copy constructor from the Tmat3 mat. More...
 
 Tmat3 (const float mat[9])
 Constructor from 9 floating point values in an array given by mat, row by row. More...
 
 Tmat3 (const double mat[9])
 Constructor from 9 double values in an array given by mat, row by row. More...
 
void set (DT val)
 Sets all values to val. More...
 
const Tmat3< DT > & operator= (const Tmat3< DT > &m)
 Assigns by a Tmat3. More...
 
const Tmat3< DT > & operator+= (const Tmat3< DT > &m)
 Increments by a Tmat3. More...
 
const Tmat3< DT > & operator-= (const Tmat3< DT > &m)
 Decrements by a Tmat3. More...
 
const Tmat3< DT > & operator*= (const DT d)
 Multiplies by a constant. More...
 
const Tmat3< DT > & operator/= (const DT d)
 Divides by a constant. Division by zero is not handled and must be avoided by caller. More...
 
static Tmat3< DT > getMat (const double val)
 Returns a matrix filled with values val. More...
 

Special Functions

DT det () const
 Determinant. More...
 
Tmat3 transpose () const
 Returns the transpose of this matrix. More...
 
Tmat3 inverse (bool *isInvertible=nullptr) const
 Returns the inverse. More...
 
const Tmat3< DT > & apply (MLDblFuncPtr fct)
 Applies the function fct to each component. More...
 
Tmat3 jacobi (Tvec3< DT > &eVal, int &rots) const
 Calculates the Jacobi-Decomposition of 3x3 matrix. More...
 
static Tmat3 getIdentity ()
 Returns the identity matrix. More...
 

Additional Inherited Members

- Protected Attributes inherited from ml::FloatingPointMatrix< Tvec3< DT >, 3 >
Tvec3< DT > v [size]
 The rows constituting the matrix. More...
 

Detailed Description

template<class DT>
class ml::Tmat3< DT >

A three by three matrix class of three row vectors.

Definition at line 36 of file mlMatrix3.h.

Member Typedef Documentation

◆ ComponentType

template<class DT >
typedef DT ml::Tmat3< DT >::ComponentType

A typedef to "export" the type of components.

Definition at line 42 of file mlMatrix3.h.

Constructor & Destructor Documentation

◆ Tmat3() [1/7]

template<class DT >
ml::Tmat3< DT >::Tmat3
inline

Builds a 3x3 matrix from 9 0 elements.

Definition at line 148 of file mlMatrix3.h.

◆ Tmat3() [2/7]

template<class DT >
ml::Tmat3< DT >::Tmat3 ( const DT  diagValue)
inline

Definition at line 155 of file mlMatrix3.h.

◆ Tmat3() [3/7]

template<class DT >
ml::Tmat3< DT >::Tmat3 ( const Tvec3< DT > &  row0,
const Tvec3< DT > &  row1,
const Tvec3< DT > &  row2 
)
inline

Builds a matrix of the three row vectors row0, row1, row2.

Definition at line 164 of file mlMatrix3.h.

◆ Tmat3() [4/7]

template<class DT >
ml::Tmat3< DT >::Tmat3 ( const Tmat3< DT > &  mat)
inline

Copy constructor from the Tmat3 mat.

Definition at line 173 of file mlMatrix3.h.

References ml::FloatingPointMatrix< VectorT, size >::v.

◆ Tmat3() [5/7]

template<class DT >
ml::Tmat3< DT >::Tmat3 ( const float  mat[9])
inline

Constructor from 9 floating point values in an array given by mat, row by row.

Definition at line 182 of file mlMatrix3.h.

◆ Tmat3() [6/7]

template<class DT >
ml::Tmat3< DT >::Tmat3 ( const double  mat[9])
inline

Constructor from 9 double values in an array given by mat, row by row.

Definition at line 189 of file mlMatrix3.h.

◆ Tmat3() [7/7]

template<class DT >
ml::Tmat3< DT >::Tmat3 ( const double  in00,
const double  in01,
const double  in02,
const double  in10,
const double  in11,
const double  in12,
const double  in20,
const double  in21,
const double  in22 
)
inline

Initializes all matrix elements explicitly with scalars, filling it row by row.

Definition at line 331 of file mlMatrix3.h.

References DCMTree::DT.

Member Function Documentation

◆ apply()

template<class DT >
const Tmat3< DT > & ml::Tmat3< DT >::apply ( MLDblFuncPtr  fct)
inline

Applies the function fct to each component.

Definition at line 448 of file mlMatrix3.h.

◆ det()

template<class DT >
DT ml::Tmat3< DT >::det

Determinant.

Definition at line 414 of file mlMatrix3.h.

References DET3.

◆ getIdentity()

template<class DT >
Tmat3< DT > ml::Tmat3< DT >::getIdentity
inlinestatic

Returns the identity matrix.

Definition at line 437 of file mlMatrix3.h.

◆ getMat()

template<class DT >
Tmat3< DT > ml::Tmat3< DT >::getMat ( const double  val)
inlinestatic

Returns a matrix filled with values val.

Definition at line 196 of file mlMatrix3.h.

◆ getValues() [1/2]

template<class DT >
void ml::Tmat3< DT >::getValues ( double  mat[9]) const
inline

Copies the contents of *this into mat, row by row.

Note that range and precision of the float values may not be sufficient for the double matrix contents.

Definition at line 382 of file mlMatrix3.h.

◆ getValues() [2/2]

template<class DT >
void ml::Tmat3< DT >::getValues ( float  mat[9]) const
inline

Copies the contents of *this into mat, row by row.

Note that range and precision of the float values may not be sufficient for the double matrix contents.

Definition at line 358 of file mlMatrix3.h.

◆ inverse()

template<class DT >
Tmat3< DT > ml::Tmat3< DT >::inverse ( bool *  isInvertible = nullptr) const

Returns the inverse.

Gauss-Jordan elimination with partial pivoting. If a non-NULL Boolean pointer is passed to isInvertible then true is returned in *isInvertible in the case of a successful inversion or false if the inversion is not possible (function return is the identity then). If a NULL pointer is passed as isInvertible the matrix must be invertible, otherwise errors will occur.

Definition at line 685 of file mlMatrix3.h.

References DCMTree::DT, and ml::MLInverseMatHelper().

◆ jacobi()

template<class DT >
Tmat3< DT > ml::Tmat3< DT >::jacobi ( Tvec3< DT > &  evalues,
int &  rots 
) const

Calculates the Jacobi-Decomposition of 3x3 matrix.

The Jacobi method is deemed to be an absolutely foolproof method for all real symmetric matrices (however a little bit slower than more sophisticated methods as QR decomposition)

Computes all eigenvalues and eigen vectors of a symmetric 3x3 matrix and returns matrix of normalized eigenvectors. evalues[1,..,3] contains the eigenvalues, rots the number of Jacobi rotations that where required.

evalues[i] <-> (eVec[0][i],eVec[1][i],eVec[2][i])

Definition at line 562 of file mlMatrix3.h.

References ml::abs(), DCMTree::DT, and ml::FloatingPointMatrix< VectorT, size >::v.

◆ operator*=()

template<class DT >
const Tmat3< DT > & ml::Tmat3< DT >::operator*= ( const DT  d)
inline

Multiplies by a constant.

Definition at line 247 of file mlMatrix3.h.

◆ operator+=()

template<class DT >
const Tmat3< DT > & ml::Tmat3< DT >::operator+= ( const Tmat3< DT > &  m)
inline

Increments by a Tmat3.

Definition at line 225 of file mlMatrix3.h.

References ml::FloatingPointMatrix< VectorT, size >::v.

◆ operator-=()

template<class DT >
const Tmat3< DT > & ml::Tmat3< DT >::operator-= ( const Tmat3< DT > &  m)
inline

Decrements by a Tmat3.

Definition at line 236 of file mlMatrix3.h.

References ml::FloatingPointMatrix< VectorT, size >::v.

◆ operator/=()

template<class DT >
const Tmat3< DT > & ml::Tmat3< DT >::operator/= ( const DT  d)
inline

Divides by a constant. Division by zero is not handled and must be avoided by caller.

Definition at line 258 of file mlMatrix3.h.

◆ operator<()

template<class DT >
bool ml::Tmat3< DT >::operator< ( const Tmat3< DT > &  ) const
inline

Dummy "lesser than operator" which always returns false.

It is needed to make class work with some STL containers on VC7.

Definition at line 93 of file mlMatrix3.h.

◆ operator=()

template<class DT >
const Tmat3< DT > & ml::Tmat3< DT >::operator= ( const Tmat3< DT > &  m)
inline

Assigns by a Tmat3.

Definition at line 212 of file mlMatrix3.h.

References ml::FloatingPointMatrix< VectorT, size >::v.

◆ set()

template<class DT >
void ml::Tmat3< DT >::set ( DT  val)
inline

Sets all values to val.

Definition at line 205 of file mlMatrix3.h.

◆ setScaleMatrix()

template<class DT >
void ml::Tmat3< DT >::setScaleMatrix ( const DT  scale)
inline

Sets a diagonal matrix with scale on diagonal.

Definition at line 394 of file mlMatrix3.h.

◆ setValues() [1/2]

template<class DT >
void ml::Tmat3< DT >::setValues ( const double  mat[9])
inline

Copies the contents of mat into *this, row by row.

Definition at line 369 of file mlMatrix3.h.

References DCMTree::DT.

◆ setValues() [2/2]

template<class DT >
void ml::Tmat3< DT >::setValues ( const float  mat[9])
inline

Copies the contents of mat into *this, row by row.

Definition at line 345 of file mlMatrix3.h.

References DCMTree::DT.

◆ transpose()

template<class DT >
Tmat3< DT > ml::Tmat3< DT >::transpose
inline

Returns the transpose of this matrix.

Definition at line 426 of file mlMatrix3.h.

Referenced by ml::operator*().


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