This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Problem with eigen Map copy CTor

Tags: None
(comma "," separated)
lplagne
Registered Member
Posts
11
Karma
0

Problem with eigen Map copy CTor

Thu Apr 16, 2015 10:33 am
Hi,

I have the following problem that only arises in debug mode:

I want to an build Eigen view on a float array via an Eigen Map inside a Class that contains a floatting point dynamic array named dataPtr_.
For this purpose I wrote a method getEigenView(...) for this class.

Code: Select all
typedef float ScalarType;
typedef Eigen::Array<ScalarType,Eigen::Dynamic,1> EigenArray;
typedef Eigen::Map<EigenArray,Eigen::Aligned> EigenView;

inline EigenView getEigenView(size_t begin, size_t chunkSize) {   
      return EigenView(this->dataPtr_+begin,chunkSize);
 }


When I use a O3 compilation flag, the code is OK and I guess that the RVO avoids the Eigen::Map Copy Ctor but when I switch to -O0 the code fails and gives the following message :
Code: Select all
/eigen-eigen-bde43366e223/Eigen/src/Core/DenseBase.h:229: void Eigen::DenseBase<Derived>::resize(Eigen::Index, Eigen::Index) [with Derived = Eigen::Map<Eigen::Array<float, -1, 1>, 1, Eigen::Stride<0, 0> >; Eigen::Index = long int]: Assertion `nbRows == this->rows() && nbCols == this->cols() && "DenseBase::resize()
does not actually allow to resize."' failed.

Any hints ?

thank you for your help,

Laurent
lplagne
Registered Member
Posts
11
Karma
0
Solved. It was a bug in my code. I tried to use operator = on map with different sizes...
Sorry for the noise.

Laurent


Bookmarks



Who is online

Registered users: Bing [Bot], Google [Bot], Yahoo [Bot]