28 #ifndef CMatrixTemplateNumeric_H
29 #define CMatrixTemplateNumeric_H
50 using namespace mrpt::system;
69 Eigen::AutoAlign | Eigen::RowMajor
73 typedef Eigen::Matrix<T,Eigen::Dynamic,Eigen::Dynamic,Eigen::AutoAlign|Eigen::RowMajor>
Base;
99 Base::resize( m.getRowCount(), m.getColCount() );
103 Base::coeffRef(i,j) =
static_cast<T
>(m.get_unsafe(i,j));
115 template <
typename V,
size_t N>
116 inline CMatrixTemplateNumeric(
size_t row,
size_t col, V (&theArray)[N] ) : Base(row,col)
120 ::
memcpy(Base::data(),&theArray[0],sizeof(T)*N);
125 inline ~CMatrixTemplateNumeric() { }
128 template <
typename Derived>
129 inline bool operator ==(
const Eigen::MatrixBase<Derived>& m2)
const
131 return Base::cols()==m2.cols() &&
132 Base::rows()==m2.rows() &&
133 Base::cwiseEqual(m2).all();
136 template <
typename Derived>
137 inline bool operator !=(
const Eigen::MatrixBase<Derived>& m2)
const{
return !((*this)==m2); }
164 #ifdef HAVE_LONG_DOUBLE
189 mat.get_unsafe(r,c)=
t;
201 static std::string
get() {
return std::string(
"CMatrixTemplateNumeric<")+ std::string(
TTypeName<T>::get() )+std::string(
">"); }