From a14e5eb20e216e23ef7995984cb8464303dca71e Mon Sep 17 00:00:00 2001 From: Antonin Portelli Date: Mon, 17 Mar 2014 15:00:59 +0000 Subject: [PATCH] aliases for Eigen base types --- lib/Global.hpp | 12 +++++++++--- lib/Mat.hpp | 2 +- lib/StatArray.hpp | 2 +- lib/XYStatData.hpp | 2 +- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/lib/Global.hpp b/lib/Global.hpp index 1f7b948..7142887 100644 --- a/lib/Global.hpp +++ b/lib/Global.hpp @@ -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 \ -ctorName(const Eigen::EigenBase &m): Base(m) {}\ +ctorName(const ExprType &m): Base(m) {}\ template\ -Class & operator=(const Eigen::EigenBase &m)\ +Class & operator=(const ExprType &m)\ {\ this->Base::operator=(m);\ return *this;\ @@ -63,10 +63,16 @@ BEGIN_NAMESPACE const int dynamic = -1; // array types +template +using ArrayExpr = Eigen::ArrayBase; + template using Array = Eigen::Array; // matrix types +template +using MatExpr = Eigen::MatrixBase; + template using Mat = Eigen::Matrix; diff --git a/lib/Mat.hpp b/lib/Mat.hpp index 7ee2884..c6a3151 100644 --- a/lib/Mat.hpp +++ b/lib/Mat.hpp @@ -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 diff --git a/lib/StatArray.hpp b/lib/StatArray.hpp index d2f9368..3d8dba1 100644 --- a/lib/StatArray.hpp +++ b/lib/StatArray.hpp @@ -41,7 +41,7 @@ public: // constructors StatArray(void); explicit StatArray(const Index size); - EIGEN_EXPR_CTOR(StatArray, unique_arg(StatArray), Base, ArrayBase) + EIGEN_EXPR_CTOR(StatArray, unique_arg(StatArray), Base, ArrayExpr) // destructor virtual ~StatArray(void) = default; // access diff --git a/lib/XYStatData.hpp b/lib/XYStatData.hpp index 75b14cc..6264917 100644 --- a/lib/XYStatData.hpp +++ b/lib/XYStatData.hpp @@ -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