ML Reference
ml::Tmat2< DT > Class Template Reference

Declaration of matrix type traits: More...

#include <mlMatrix2.h>

Inheritance diagram for ml::Tmat2< DT >:
ml::FloatingPointMatrix< Tvec2< DT >, 2 >

Public Types

typedef DT ComponentType
 A typedef to "export" the type of components.
 
- Public Types inherited from ml::FloatingPointMatrix< Tvec2< DT >, 2 >
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.
 
typedef Tvec2< DT > VectorType
 A typedef to "export" the type of component vector.
 

Public Member Functions

bool operator< (const Tmat2< DT > &) const
 Dummy "lesser than operator" which always returns false.
 
Operators and indexing functionality.
const Tmat2< DT > & operator= (const Tmat2< DT > &m)
 Assigns from a Tmat2.
 
const Tmat2< DT > & operator+= (const Tmat2< DT > &m)
 Increments by a Tmat2.
 
const Tmat2< DT > & operator-= (const Tmat2< DT > &m)
 Decrements by a Tmat2.
 
const Tmat2< DT > & operator*= (const DT d)
 Multiplies by a constant d.
 
const Tmat2< DT > & operator/= (const DT d)
 Divides by a constant d. Division by zero is not handled and must be avoided by caller.
 
Special functions for class Tmat2.
DT det () const
 Returns the determinant of this matrix.
 
Tmat2< DT > transpose () const
 Returns the transposed matrix.
 
Tmat2< DT > inverse (bool *isInvertible=nullptr) const
 
const Tmat2< DT > & apply (MLDblFuncPtr fct)
 Applies the method fct to all vectors of *this and return the matrix.
 
- Public Member Functions inherited from ml::FloatingPointMatrix< Tvec2< DT >, 2 >
const Tvec2< DT > & operator[] (const size_t i) const
 
Tvec2< 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.
 
void getValuesToPtr (ComponentType *values) const
 Copies contents of *this into array mat, row by row; type and size must match.
 

Constructors, set and get methods.

 Tmat2 ()
 Constructs the matrix from 4 zero elements.
 
 Tmat2 (const DT diagValue)
 
 Tmat2 (const Tvec2< DT > &row0, const Tvec2< DT > &row1)
 Composes a matrix from the two vectors row0 and row1.
 
 Tmat2 (const Tmat2< DT > &mat)
 Copy constructor from the Tmat2 mat.
 
 Tmat2 (const float mat[4])
 Constructor from 4 floating point values in an array given by mat, row by row.
 
 Tmat2 (const double mat[4])
 Constructor from 4 double values in an array given by mat, row by row.
 
 Tmat2 (const DT in00, const DT in01, const DT in10, const DT in11)
 Initializes all matrix elements explicitly with scalars, row by row.
 
void setValues (const float mat[4])
 Copies the contents of mat into *this, row by row.
 
void getValues (float mat[4]) const
 Copies the contents of *this into mat, row by row.
 
void setValues (const double mat[4])
 Copies the contents of mat into *this, row by row.
 
void getValues (double mat[4]) const
 Copies the contents of *this into mat, row by row.
 
void set (const DT val)
 Sets all values to val.
 
void setScaleMatrix (const DT scale)
 Sets a diagonal matrix with scale on diagonal.
 
static Tmat2< DT > getMat (const DT val)
 Returns a matrix filled with values val.
 
static Tmat2< DT > getIdentity ()
 Returns the identity matrix.
 

Additional Inherited Members

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

Detailed Description

template<class DT>
class ml::Tmat2< DT >

Declaration of matrix type traits:

A two by two matrix class consisting of 2 row vectors.

Definition at line 34 of file mlMatrix2.h.

Member Typedef Documentation

◆ ComponentType

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

A typedef to "export" the type of components.

Definition at line 39 of file mlMatrix2.h.

Constructor & Destructor Documentation

◆ Tmat2() [1/7]

template<class DT >
ml::Tmat2< DT >::Tmat2 ( )
inline

Constructs the matrix from 4 zero elements.

Definition at line 149 of file mlMatrix2.h.

◆ Tmat2() [2/7]

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

Definition at line 156 of file mlMatrix2.h.

◆ Tmat2() [3/7]

template<class DT >
ml::Tmat2< DT >::Tmat2 ( const Tvec2< DT > & row0,
const Tvec2< DT > & row1 )
inline

Composes a matrix from the two vectors row0 and row1.

Definition at line 165 of file mlMatrix2.h.

◆ Tmat2() [4/7]

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

Copy constructor from the Tmat2 mat.

Definition at line 174 of file mlMatrix2.h.

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

◆ Tmat2() [5/7]

template<class DT >
ml::Tmat2< DT >::Tmat2 ( const float mat[4])
inline

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

Definition at line 182 of file mlMatrix2.h.

◆ Tmat2() [6/7]

template<class DT >
ml::Tmat2< DT >::Tmat2 ( const double mat[4])
inline

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

Definition at line 189 of file mlMatrix2.h.

◆ Tmat2() [7/7]

template<class DT >
ml::Tmat2< DT >::Tmat2 ( const DT in00,
const DT in01,
const DT in10,
const DT in11 )
inline

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

Definition at line 196 of file mlMatrix2.h.

Member Function Documentation

◆ apply()

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

Applies the method fct to all vectors of *this and return the matrix.

Definition at line 294 of file mlMatrix2.h.

References ml::Tmat2< DT >::apply().

Referenced by ml::Tmat2< DT >::apply().

◆ det()

template<class DT >
DT ml::Tmat2< DT >::det ( ) const
inline

Returns the determinant of this matrix.

Definition at line 279 of file mlMatrix2.h.

◆ getIdentity()

template<class DT >
Tmat2< DT > ml::Tmat2< DT >::getIdentity ( )
inlinestatic

Returns the identity matrix.

Definition at line 256 of file mlMatrix2.h.

◆ getMat()

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

Returns a matrix filled with values val.

Definition at line 241 of file mlMatrix2.h.

◆ getValues() [1/2]

template<class DT >
void ml::Tmat2< DT >::getValues ( double mat[4]) 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 233 of file mlMatrix2.h.

◆ getValues() [2/2]

template<class DT >
void ml::Tmat2< DT >::getValues ( float mat[4]) 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 223 of file mlMatrix2.h.

◆ inverse()

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

Definition at line 311 of file mlMatrix2.h.

References ML_BAD_PARAMETER, MLValueIs0WOM(), and ml::printTemplateError().

◆ operator*=()

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

Multiplies by a constant d.

Definition at line 385 of file mlMatrix2.h.

◆ operator+=()

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

Increments by a Tmat2.

Definition at line 367 of file mlMatrix2.h.

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

◆ operator-=()

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

Decrements by a Tmat2.

Definition at line 376 of file mlMatrix2.h.

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

◆ operator/=()

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

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

Definition at line 394 of file mlMatrix2.h.

◆ operator<()

template<class DT >
bool ml::Tmat2< DT >::operator< ( const Tmat2< 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 100 of file mlMatrix2.h.

◆ operator=()

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

Assigns from a Tmat2.

Definition at line 356 of file mlMatrix2.h.

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

◆ set()

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

Sets all values to val.

Definition at line 249 of file mlMatrix2.h.

◆ setScaleMatrix()

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

Sets a diagonal matrix with scale on diagonal.

Definition at line 263 of file mlMatrix2.h.

◆ setValues() [1/2]

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

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

Definition at line 213 of file mlMatrix2.h.

◆ setValues() [2/2]

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

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

Definition at line 205 of file mlMatrix2.h.

◆ transpose()

template<class DT >
Tmat2< DT > ml::Tmat2< DT >::transpose ( ) const
inline

Returns the transposed matrix.

Definition at line 286 of file mlMatrix2.h.

Referenced by ml::operator*().


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