Main MRPT website > C++ reference for MRPT 1.4.0
List of all members | Public Types | Public Member Functions
mrpt::math::CMatrixTemplateNumeric< T > Class Template Reference

Detailed Description

template<class T>
class mrpt::math::CMatrixTemplateNumeric< T >

A matrix of dynamic size.

Basically, this class is a wrapper on Eigen::Matrix<T,Dynamic,Dynamic>, but with a RowMajor element memory layout (except for column vectors).

Note
This class exists for backward compatibility of ancient times when MRPT didn't rely on Eigen, feel free to directly use Eigen::Matrix<> types instead.
See also
CMatrixTemplate (a non Eigen lib-based class, which can hold arbitrary objects, not only numerical types).
Note
For a complete introduction to Matrices and vectors in MRPT, see: http://www.mrpt.org/Matrices_vectors_arrays_and_Linear_Algebra_MRPT_and_Eigen_classes

Definition at line 32 of file CMatrixTemplateNumeric.h.

#include <mrpt/math/CMatrixTemplateNumeric.h>

Inheritance diagram for mrpt::math::CMatrixTemplateNumeric< T >:
Inheritance graph

Public Types

typedef Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic, Eigen::AutoAlign|Eigen::RowMajor > Base
 
typedef CMatrixTemplateNumeric< T > mrpt_autotype
 

Public Member Functions

 CMatrixTemplateNumeric ()
 Default constructor, builds a 1x1 matrix.
 
 CMatrixTemplateNumeric (TConstructorFlags_Matrices)
 Constructor that builds a 0x0 matrix (that is, uninitialized), for usage in places where efficiency is a priority.
 
 CMatrixTemplateNumeric (size_t row, size_t col)
 Constructor, creates a matrix of the given size, filled with zeros.
 
template<class R >
CMatrixTemplateNumeric< T > & operator= (const CMatrixTemplate< R > &m)
 Assignment operator of other types.
 
template<typename Derived >
CMatrixTemplateNumeric< T > & operator= (const Eigen::MatrixBase< Derived > &m) const
 Assignment from any Eigen matrix/vector.
 
template<typename V , size_t N>
 CMatrixTemplateNumeric (size_t row, size_t col, V(&theArray)[N])
 Constructor from a given size and a C array.
 
 ~CMatrixTemplateNumeric ()
 Destructor.
 
template<typename Derived >
bool operator== (const Eigen::MatrixBase< Derived > &m2) const
 == comparison of two matrices; it differs from default Eigen operator in that returns false if matrices are of different sizes instead of raising an assert.
 
template<typename Derived >
bool operator!= (const Eigen::MatrixBase< Derived > &m2) const
 != comparison of two matrices; it differs from default Eigen operator in that returns true if matrices are of different sizes instead of raising an assert.
 

Member Typedef Documentation

◆ Base

template<class T >
typedef Eigen::Matrix<T,Eigen::Dynamic,Eigen::Dynamic,Eigen::AutoAlign|Eigen::RowMajor> mrpt::math::CMatrixTemplateNumeric< T >::Base

Definition at line 42 of file CMatrixTemplateNumeric.h.

◆ mrpt_autotype

template<class T >
typedef CMatrixTemplateNumeric<T> mrpt::math::CMatrixTemplateNumeric< T >::mrpt_autotype

Definition at line 43 of file CMatrixTemplateNumeric.h.

Constructor & Destructor Documentation

◆ CMatrixTemplateNumeric() [1/4]

template<class T >
mrpt::math::CMatrixTemplateNumeric< T >::CMatrixTemplateNumeric ( )
inline

Default constructor, builds a 1x1 matrix.

Definition at line 48 of file CMatrixTemplateNumeric.h.

◆ CMatrixTemplateNumeric() [2/4]

template<class T >
mrpt::math::CMatrixTemplateNumeric< T >::CMatrixTemplateNumeric ( TConstructorFlags_Matrices  )
inline

Constructor that builds a 0x0 matrix (that is, uninitialized), for usage in places where efficiency is a priority.

Use as:

Definition at line 56 of file CMatrixTemplateNumeric.h.

◆ CMatrixTemplateNumeric() [3/4]

template<class T >
mrpt::math::CMatrixTemplateNumeric< T >::CMatrixTemplateNumeric ( size_t  row,
size_t  col 
)
inline

Constructor, creates a matrix of the given size, filled with zeros.

Definition at line 59 of file CMatrixTemplateNumeric.h.

◆ CMatrixTemplateNumeric() [4/4]

template<class T >
template<typename V , size_t N>
mrpt::math::CMatrixTemplateNumeric< T >::CMatrixTemplateNumeric ( size_t  row,
size_t  col,
V(&)  theArray[N] 
)
inline

Constructor from a given size and a C array.

The array length must match cols x row.

const double numbers[] = {
1,2,3,
4,5,6 };
CMatrixDouble M(3,2, numbers);

Definition at line 94 of file CMatrixTemplateNumeric.h.

References ASSERT_EQUAL_.

◆ ~CMatrixTemplateNumeric()

template<class T >
mrpt::math::CMatrixTemplateNumeric< T >::~CMatrixTemplateNumeric ( )
inline

Destructor.

Definition at line 103 of file CMatrixTemplateNumeric.h.

Member Function Documentation

◆ operator!=()

template<class T >
template<typename Derived >
bool mrpt::math::CMatrixTemplateNumeric< T >::operator!= ( const Eigen::MatrixBase< Derived > &  m2) const
inline

!= comparison of two matrices; it differs from default Eigen operator in that returns true if matrices are of different sizes instead of raising an assert.

Definition at line 115 of file CMatrixTemplateNumeric.h.

◆ operator=() [1/2]

template<class T >
template<class R >
CMatrixTemplateNumeric< T > & mrpt::math::CMatrixTemplateNumeric< T >::operator= ( const CMatrixTemplate< R > &  m)
inline

◆ operator=() [2/2]

template<class T >
template<typename Derived >
CMatrixTemplateNumeric< T > & mrpt::math::CMatrixTemplateNumeric< T >::operator= ( const Eigen::MatrixBase< Derived > &  m) const
inline

Assignment from any Eigen matrix/vector.

Definition at line 78 of file CMatrixTemplateNumeric.h.

◆ operator==()

template<class T >
template<typename Derived >
bool mrpt::math::CMatrixTemplateNumeric< T >::operator== ( const Eigen::MatrixBase< Derived > &  m2) const
inline

== comparison of two matrices; it differs from default Eigen operator in that returns false if matrices are of different sizes instead of raising an assert.

Definition at line 107 of file CMatrixTemplateNumeric.h.




Page generated by Doxygen 1.9.6 for MRPT 1.4.0 SVN: at Thu Jan 19 22:37:47 UTC 2023