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

cleaner Eigen expression integration and constructor inheritance for StatArray and derived

This commit is contained in:
Antonin Portelli 2014-02-17 18:50:03 +00:00
parent f7345ea717
commit b53b47fcda
6 changed files with 20 additions and 17 deletions

View File

@ -42,8 +42,6 @@ public:
using Base::Base;
Dataset(void);
Dataset(const std::string &listFileName, const std::string &dataName);
template <typename Derived>
Dataset(const Eigen::EigenBase<Derived> &dataset);
// destructor
virtual ~Dataset(void);
// IO

View File

@ -27,6 +27,9 @@
#define BEGIN_NAMESPACE namespace Latan {
#define END_NAMESPACE }
// macro utilities
#define unique_arg(...) __VA_ARGS__
// attribute to switch off unused warnings with gcc
#ifdef __GNUC__
#define __dumb __attribute__((unused))
@ -35,7 +38,18 @@
#endif
// max length for paths
#define MAX_PATH_LENGTH 512
#define MAX_PATH_LENGTH 512u
// copy/assignement from Eigen expression
#define EIGEN_EXPR_CTOR(ctorName, Class, Base, EigenBase) \
template <typename Derived>\
ctorName(const Eigen::EigenBase<Derived> &m): Base(m) {};\
template<typename Derived>\
Class & operator=(const Eigen::EigenBase<Derived> &m)\
{\
this->Base::operator=(m);\
return *this;\
}
BEGIN_NAMESPACE

View File

@ -34,17 +34,11 @@ public:
// constructors
DMat(void);
DMat(const unsigned int nRow, const unsigned int nCol);
template <typename Derived>
DMat(const Eigen::EigenBase<Derived> &m);
EIGEN_EXPR_CTOR(DMat, DMat, Base, MatrixBase);
// IO
virtual IoType getType(void) const;
};
template <typename Derived>
DMat::DMat(const Eigen::EigenBase<Derived> &m)
: Base(m)
{}
END_NAMESPACE
#endif // Latan_Mat_hpp_

View File

@ -23,7 +23,7 @@
#include <latan/Global.hpp>
#include <latan/IoObject.hpp>
#define RLXG_STATE_SIZE 105
#define RLXG_STATE_SIZE 105u
BEGIN_NAMESPACE

View File

@ -41,10 +41,7 @@ private:
typedef StatArray<T, SAMPLE_OFFSET> Base;
public:
// constructors
Sample(void);
Sample(const unsigned int nSample);
template <typename Derived>
Sample(const Eigen::EigenBase<Derived> &s);
using Base::Base;
// destructor
virtual ~Sample(void);
};

View File

@ -38,8 +38,8 @@ public:
// constructors
StatArray(void);
StatArray(const unsigned int size);
template <typename Derived>
StatArray(const Eigen::EigenBase<Derived> &s);
EIGEN_EXPR_CTOR(StatArray, unique_arg(StatArray<T, offset>), Base,
ArrayBase);
// destructor
virtual ~StatArray(void);
// access