9#ifndef CMatrixTemplateNumeric_H
10#define CMatrixTemplateNumeric_H
38 Eigen::AutoAlign | Eigen::RowMajor
42 typedef Eigen::Matrix<T,Eigen::Dynamic,Eigen::Dynamic,Eigen::AutoAlign|Eigen::RowMajor>
Base;
70 for (
size_t i=0; i < CMatrixTemplate<T>::getRowCount(); i++)
71 for (
size_t j=0; j < CMatrixTemplate<T>::getColCount(); j++)
72 Base::coeffRef(i,j) =
static_cast<T
>(m.
get_unsafe(i,j));
77 template <
typename Derived>
93 template <
typename V,
size_t N>
98 ::memcpy(Base::data(),&theArray[0],
sizeof(T)*N);
106 template <
typename Derived>
107 inline bool operator ==(
const Eigen::MatrixBase<Derived>& m2)
const
109 return Base::cols()==m2.cols() &&
110 Base::rows()==m2.rows() &&
111 Base::cwiseEqual(m2).all();
114 template <
typename Derived>
115 inline bool operator !=(
const Eigen::MatrixBase<Derived>& m2)
const{
return !((*this)==m2); }
137#ifdef HAVE_LONG_DOUBLE
162 mat.get_unsafe(r,c)=
t;
174 static std::string
get() {
return std::string(
"CMatrixTemplateNumeric<")+ std::string(
TTypeName<T>::get() )+std::string(
">"); }
This template class provides the basic functionality for a general 2D any-size, resizable container o...
const T & get_unsafe(size_t row, size_t col) const
Fast but unsafe method to read a value from the matrix.
size_t getColCount() const
Number of columns in the matrix.
size_t getRowCount() const
Number of rows in the matrix.
A matrix of dynamic size.
CMatrixTemplateNumeric< T > mrpt_autotype
bool operator==(const Eigen::MatrixBase< Derived > &m2) const
== comparison of two matrices; it differs from default Eigen operator in that returns false if matric...
Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic, Eigen::AutoAlign|Eigen::RowMajor > Base
bool operator!=(const Eigen::MatrixBase< Derived > &m2) const
!= comparison of two matrices; it differs from default Eigen operator in that returns true if matrice...
CMatrixTemplateNumeric(TConstructorFlags_Matrices)
Constructor that builds a 0x0 matrix (that is, uninitialized), for usage in places where efficiency i...
CMatrixTemplateNumeric< T > & operator=(const CMatrixTemplate< R > &m)
Assignment operator of other types.
CMatrixTemplateNumeric(size_t row, size_t col, V(&theArray)[N])
Constructor from a given size and a C array.
CMatrixTemplateNumeric(size_t row, size_t col)
Constructor, creates a matrix of the given size, filled with zeros.
~CMatrixTemplateNumeric()
Destructor.
static void insertInContainer(CMatrixTemplateNumeric< T > &mat, size_t r, size_t c, const T &t)
static void initialize(CMatrixTemplateNumeric< T > &mat, size_t N)
The purpose of this class is to model traits for containers, so that they can be used as return value...
EIGEN_STRONG_INLINE const AdjointReturnType t() const
Transpose.
#define MRPT_MATRIX_CONSTRUCTORS_FROM_POSES(_CLASS_)
#define ASSERT_EQUAL_(__A, __B)
CMatrixTemplateNumeric< unsigned int > CMatrixUInt
Declares a matrix of unsigned ints (non serializable).
TConstructorFlags_Matrices
For usage in one of the constructors of CMatrixFixedNumeric or CMatrixTemplate (and derived classes),...
CMatrixTemplateNumeric< double > CMatrixLongDouble
Declares a matrix of "long doubles" (non serializable), or of "doubles" if the compiler does not supp...
CMatrixTemplateNumeric< float > CMatrixFloat
Declares a matrix of float numbers (non serializable).
CMatrixTemplateNumeric< double > CMatrixDouble
Declares a matrix of double numbers (non serializable).
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
A template to obtain the type of its argument as a string at compile time.
#define MRPT_EIGEN_DERIVED_CLASS_CTOR_OPERATOR_EQUAL(_CLASS_)