1
0
mirror of https://github.com/aportelli/LatAnalyze.git synced 2024-11-10 08:55:37 +00:00

aliases for Eigen base types

This commit is contained in:
Antonin Portelli 2014-03-17 15:00:59 +00:00
parent 3bebfb6e10
commit a14e5eb20e
4 changed files with 12 additions and 6 deletions

View File

@ -47,11 +47,11 @@
#define MAX_PATH_LENGTH 512u #define MAX_PATH_LENGTH 512u
// copy/assignement from Eigen expression // copy/assignement from Eigen expression
#define EIGEN_EXPR_CTOR(ctorName, Class, Base, EigenBase) \ #define EIGEN_EXPR_CTOR(ctorName, Class, Base, ExprType) \
template <typename Derived>\ template <typename Derived>\
ctorName(const Eigen::EigenBase<Derived> &m): Base(m) {}\ ctorName(const ExprType<Derived> &m): Base(m) {}\
template<typename Derived>\ template<typename Derived>\
Class & operator=(const Eigen::EigenBase<Derived> &m)\ Class & operator=(const ExprType<Derived> &m)\
{\ {\
this->Base::operator=(m);\ this->Base::operator=(m);\
return *this;\ return *this;\
@ -63,10 +63,16 @@ BEGIN_NAMESPACE
const int dynamic = -1; const int dynamic = -1;
// array types // array types
template <typename Derived>
using ArrayExpr = Eigen::ArrayBase<Derived>;
template <typename T, int nRow = dynamic, int nCol = dynamic> template <typename T, int nRow = dynamic, int nCol = dynamic>
using Array = Eigen::Array<T, nRow, nCol>; using Array = Eigen::Array<T, nRow, nCol>;
// matrix types // matrix types
template <typename Derived>
using MatExpr = Eigen::MatrixBase<Derived>;
template <typename T, int nRow = dynamic, int nCol = dynamic> template <typename T, int nRow = dynamic, int nCol = dynamic>
using Mat = Eigen::Matrix<T, nRow, nCol>; using Mat = Eigen::Matrix<T, nRow, nCol>;

View File

@ -41,7 +41,7 @@ public:
// constructors // constructors
DMat(void) = default; DMat(void) = default;
DMat(const Index nRow, const Index nCol); DMat(const Index nRow, const Index nCol);
EIGEN_EXPR_CTOR(DMat, DMat, Base, MatrixBase) EIGEN_EXPR_CTOR(DMat, DMat, Base, MatExpr)
// destructor // destructor
virtual ~DMat(void) = default; virtual ~DMat(void) = default;
// IO // IO

View File

@ -41,7 +41,7 @@ public:
// constructors // constructors
StatArray(void); StatArray(void);
explicit StatArray(const Index size); explicit StatArray(const Index size);
EIGEN_EXPR_CTOR(StatArray, unique_arg(StatArray<T, os>), Base, ArrayBase) EIGEN_EXPR_CTOR(StatArray, unique_arg(StatArray<T, os>), Base, ArrayExpr)
// destructor // destructor
virtual ~StatArray(void) = default; virtual ~StatArray(void) = default;
// access // access

View File

@ -40,7 +40,7 @@ class FitResult: public DVec
public: public:
// constructors // constructors
FitResult(void) = default; FitResult(void) = default;
EIGEN_EXPR_CTOR(FitResult, FitResult, Base, MatrixBase) EIGEN_EXPR_CTOR(FitResult, FitResult, Base, MatExpr)
// destructor // destructor
virtual ~FitResult(void) = default; virtual ~FitResult(void) = default;
// access // access