Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef CMATRIX_H
00029 #define CMATRIX_H
00030
00031 #include <mrpt/utils/CSerializable.h>
00032 #include <mrpt/math/CMatrixTemplateNumeric.h>
00033 #include <mrpt/math/CMatrixFixedNumeric.h>
00034 #include <mrpt/utils/CStream.h>
00035
00036 namespace mrpt
00037 {
00038 namespace math
00039 {
00040
00041
00042
00043 DEFINE_MRPT_OBJECT_PRE_CUSTOM_BASE_LINKAGE2(CMatrix, mrpt::utils::CSerializable, CMatrix)
00044 BASE_IMPEXP ::mrpt::utils::CStream& operator>>(mrpt::utils::CStream& in, CMatrixPtr &pObj);
00045
00046
00047
00048
00049
00050 class BASE_IMPEXP_TEMPL CMatrix : public mrpt::utils::CSerializable, public CMatrixFloat
00051 {
00052
00053
00054
00055 protected:
00056 static const mrpt::utils::TRuntimeClassId* _GetBaseClass();
00057 static mrpt::utils::CLASSINIT _init_CMatrix;
00058 public:
00059
00060 typedef CMatrixPtr SmartPtr;
00061 static BASE_IMPEXP mrpt::utils::TRuntimeClassId classCMatrix;
00062 static BASE_IMPEXP const mrpt::utils::TRuntimeClassId *classinfo;
00063 virtual BASE_IMPEXP const mrpt::utils::TRuntimeClassId* GetRuntimeClass() const;
00064 static BASE_IMPEXP mrpt::utils::CObject* CreateObject();
00065 static BASE_IMPEXP CMatrixPtr Create();
00066 virtual BASE_IMPEXP mrpt::utils::CObject *duplicate() const;
00067 protected:
00068
00069
00070 BASE_IMPEXP void writeToStream(mrpt::utils::CStream &out, int *getVersion) const;
00071 BASE_IMPEXP void readFromStream(mrpt::utils::CStream &in, int version);
00072
00073
00074 public:
00075
00076 CMatrix() : CMatrixFloat(1,1)
00077 { }
00078
00079
00080 CMatrix(size_t row, size_t col) : CMatrixFloat(row,col)
00081 { }
00082
00083
00084
00085 CMatrix( const CMatrixFloat &m ) : CMatrixFloat(m)
00086 { }
00087
00088
00089
00090 CMatrix( const CMatrixTemplateNumeric<double> &m ) : CMatrixFloat(0,0)
00091 {
00092 *this = m.eval().cast<float>();
00093 }
00094
00095
00096
00097 explicit CMatrix( const TPose2D &p) : CMatrixFloat(p) {}
00098
00099
00100
00101 explicit CMatrix( const TPose3D &p) : CMatrixFloat(p) {}
00102
00103
00104
00105 explicit CMatrix( const TPoint2D &p) : CMatrixFloat(p) {}
00106
00107
00108
00109 explicit CMatrix( const TPoint3D &p) : CMatrixFloat(p) {}
00110
00111
00112
00113 template <class OTHERMAT>
00114 inline CMatrix & operator = (const OTHERMAT& m)
00115 {
00116 CMatrixFloat::operator =(m);
00117 return *this;
00118 }
00119
00120
00121 template<typename OtherDerived>
00122 inline CMatrix & operator= (const Eigen::MatrixBase <OtherDerived>& other) {
00123 CMatrixTemplateNumeric<float>::operator=(other);
00124 return *this;
00125 }
00126
00127 template<typename OtherDerived>
00128 inline CMatrix(const Eigen::MatrixBase <OtherDerived>& other) : CMatrixTemplateNumeric<float>(other) { }
00129
00130 };
00131
00132 }
00133 }
00134
00135 #endif