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

Segfaul with Eigen::QuaternionMapd and std::vector

Tags: None
(comma "," separated)
rick187
Registered Member
Posts
1
Karma
0
Hallo,

first of all I want to congratulate you for the work you have been doing. I have been using it a lot for my PhD.
I have a long std::vector<double> and i want to treat some parts of it as eigen classes.
In particular I have this structure for my vector q:
stdVec = [ vector3d | quterniond | vector3d | vector3d] (13 elements in total)
I was trying to use eigen maps to avoid copying and increase performance in my code.
I do:
Code: Select all
   Eigen::Map< Eigen::Quaterniond > rot(&stdVec[3]);
   Eigen::Map< Eigen::Vector3d > vec2(&stdVec[7]);
   Eigen::Map< Eigen::Vector3d > vec3(&stdVec[10]);

there seems to be no problems when dealing with the two vectors but if I do
Code: Select all
rot = rot*rot

I get a segfault.
I have also tried a simpler thing like this:
Code: Select all
   std::vector<double> rotArray(5);
   Eigen::QuaternionMapd test(&rotArray[0]);
   test = test*test;

and it works fine while this:
Code: Select all
   std::vector<double> rotArray(5);
   Eigen::QuaternionMapd test(&rotArray[1]);
   test = test*test;

causes a segfault.
I guess this has something to do with the problems described here http://eigen.tuxfamily.org/dox/TopicStlContainers.html but this seems to be a "complementary" problem: I don't want vectors of eigen::quaterniond but a quaternionMapd using a vector.
the strange thing is that the other vectors don't seem to create problems.
Thanks for your help.
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS
Works for me. Which Eigen version are you using? Perhaps you should upgrade to 3.1.3.


Bookmarks



Who is online

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