1
0
mirror of https://github.com/aportelli/LatAnalyze.git synced 2024-09-20 05:25:37 +01: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
// copy/assignement from Eigen expression
#define EIGEN_EXPR_CTOR(ctorName, Class, Base, EigenBase) \
#define EIGEN_EXPR_CTOR(ctorName, Class, Base, ExprType) \
template <typename Derived>\
ctorName(const Eigen::EigenBase<Derived> &m): Base(m) {}\
ctorName(const ExprType<Derived> &m): Base(m) {}\
template<typename Derived>\
Class & operator=(const Eigen::EigenBase<Derived> &m)\
Class & operator=(const ExprType<Derived> &m)\
{\
this->Base::operator=(m);\
return *this;\
@ -63,10 +63,16 @@ BEGIN_NAMESPACE
const int dynamic = -1;
// array types
template <typename Derived>
using ArrayExpr = Eigen::ArrayBase<Derived>;
template <typename T, int nRow = dynamic, int nCol = dynamic>
using Array = Eigen::Array<T, nRow, nCol>;
// matrix types
template <typename Derived>
using MatExpr = Eigen::MatrixBase<Derived>;
template <typename T, int nRow = dynamic, int nCol = dynamic>
using Mat = Eigen::Matrix<T, nRow, nCol>;

View File

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

View File

@ -41,7 +41,7 @@ public:
// constructors
StatArray(void);
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
virtual ~StatArray(void) = default;
// access

View File

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