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;
72 Base::coeffRef(i,j) =
static_cast<T
>(m.
get_unsafe(i,j));
77 template <
typename Derived>
78 inline CMatrixTemplateNumeric<T>& operator =(
const Eigen::MatrixBase<Derived>& m)
const 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(
">"); }
bool operator!=(const CArray< T, N > &x, const CArray< T, N > &y)
#define ASSERT_EQUAL_(__A, __B)
const T & get_unsafe(size_t row, size_t col) const
Fast but unsafe method to read a value from the matrix.
TConstructorFlags_Matrices
For usage in one of the constructors of CMatrixFixedNumeric or CMatrixTemplate (and derived classes)...
#define MRPT_EIGEN_DERIVED_CLASS_CTOR_OPERATOR_EQUAL(_CLASS_)
void BASE_IMPEXP memcpy(void *dest, size_t destSize, const void *src, size_t copyCount) MRPT_NO_THROWS
An OS and compiler independent version of "memcpy".
A template to obtain the type of its argument as a string at compile time.
static void insertInContainer(CMatrixTemplateNumeric< T > &mat, size_t r, size_t c, const T &t)
EIGEN_STRONG_INLINE const AdjointReturnType t() const
Transpose.
CMatrixTemplateNumeric< T > mrpt_autotype
EIGEN_STRONG_INLINE size_t getColCount() const
Get number of columns.
The purpose of this class is to model traits for containers, so that they can be used as return value...
CMatrixTemplateNumeric< double > CMatrixDouble
Declares a matrix of double numbers (non serializable).
bool operator==(const CArray< T, N > &x, const CArray< T, N > &y)
#define MRPT_MATRIX_CONSTRUCTORS_FROM_POSES(_CLASS_)
CMatrixTemplateNumeric< float > CMatrixFloat
Declares a matrix of float numbers (non serializable).
Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic, Eigen::AutoAlign|Eigen::RowMajor > Base
This template class provides the basic functionality for a general 2D any-size, resizable container o...
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
CMatrixTemplateNumeric< unsigned int > CMatrixUInt
Declares a matrix of unsigned ints (non serializable).
size_t getColCount() const
Number of columns in the matrix.
A matrix of dynamic size.
size_t getRowCount() const
Number of rows in the matrix.
CMatrixTemplateNumeric< double > CMatrixLongDouble
Declares a matrix of "long doubles" (non serializable), or of "doubles" if the compiler does not supp...
EIGEN_STRONG_INLINE size_t getRowCount() const
Get number of rows.
CMatrixTemplateNumeric(TConstructorFlags_Matrices)
Constructor that builds a 0x0 matrix (that is, uninitialized), for usage in places where efficiency i...
CMatrixTemplateNumeric(size_t row, size_t col)
Constructor, creates a matrix of the given size, filled with zeros.
CMatrixTemplateNumeric()
Default constructor, builds a 1x1 matrix.
static void initialize(CMatrixTemplateNumeric< T > &mat, size_t N)