From 1a0cb2459ea7c744038430ed20d936f2a601b535 Mon Sep 17 00:00:00 2001 From: Antonin Portelli Date: Wed, 12 Feb 2014 18:37:29 +0000 Subject: [PATCH] Matrix: improvement to support Eigen expressions --- latan/Mat.cpp | 12 ++---------- latan/Mat.hpp | 19 ++++++++++--------- 2 files changed, 12 insertions(+), 19 deletions(-) diff --git a/latan/Mat.cpp b/latan/Mat.cpp index 783ac49..974602d 100644 --- a/latan/Mat.cpp +++ b/latan/Mat.cpp @@ -28,19 +28,11 @@ using namespace Latan; ******************************************************************************/ // constructors //////////////////////////////////////////////////////////////// DMat::DMat(void) -: DMatBase() -{} - -DMat::DMat(const DMatBase &m) -: DMatBase(m) -{} - -DMat::DMat(const DMat &m) -: DMatBase(m) +: Base() {} DMat::DMat(const unsigned int nRow, const unsigned int nCol) -: DMatBase(nRow, nCol) +: Base(nRow, nCol) {} unsigned int DMat::getType(void) const diff --git a/latan/Mat.hpp b/latan/Mat.hpp index 4a6fa85..e3875d5 100644 --- a/latan/Mat.hpp +++ b/latan/Mat.hpp @@ -26,24 +26,25 @@ BEGIN_NAMESPACE -// Eigen aliases -typedef Eigen::MatrixXd DMatBase; -typedef Eigen::MatrixXcd CMatBase; -typedef Eigen::VectorXd DVecBase; -typedef Eigen::VectorXcd CVecBase; - -class DMat: public DMatBase, public IoObject +class DMat: public Eigen::MatrixXd, public IoObject { +private: + typedef Eigen::MatrixXd Base; public: // constructors DMat(void); - DMat(const DMatBase &m); - DMat(const DMat &m); DMat(const unsigned int nRow, const unsigned int nCol); + template + DMat(const Eigen::EigenBase &m); // IO virtual unsigned int getType(void) const; }; +template +DMat::DMat(const Eigen::EigenBase &m) +: Base(m) +{} + END_NAMESPACE #endif // Latan_Mat_hpp_