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

Eigen::DontAlign

Tags: None
(comma "," separated)
lquack
Registered Member
Posts
3
Karma
0

Eigen::DontAlign

Thu Nov 29, 2012 11:10 am
Hi Eigen-Folks,

I am using the Vector and Quaternion classes from Eigen and recently ran into the assert about unaligned arrays[1].
I don't really care about vectorization so I defined EIGEN_DONT_ALIGN globally.
Then I stumbled upon the "_Options" template argument for the Matrix type [2].
I thought that passing Eigen::DontAlign as template argument would have the same effect as defining EIGEN_DONT_ALIGN.
But when using just Eigen::DontAlign I get the assert failure whereas I don't get it if I use the macro definition.

Is this a bug or am I misunderstanding the purpose of the template argument?

Thanks for your time and any help you can offer.
Sincerely,
Lorenz

[1] http://eigen.tuxfamily.org/dox/TopicUna ... ssert.html
[2] https://bitbucket.org/eigen/eigen/src/d ... ault#cl-32
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS

Re: Eigen::DontAlign

Thu Nov 29, 2012 3:13 pm
Please run your program under a debugger to identify where the assertion is called, it must be on an object for which Eigen::DontAlign has not been set.
lquack
Registered Member
Posts
3
Karma
0

Re: Eigen::DontAlign

Thu Nov 29, 2012 4:33 pm
Hi Gael,

thanks for getting back to me.

I think I tracked the problem down to Eigen/src/Geometry/Quaternion.h.
There are a few places (e.g. Quaternion::Identity()) where a method returns a Quaternion<scalar> ignoring the _Options set on the class.
There might be other places but this is where I hit the assert first.
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS

Re: Eigen::DontAlign

Fri Nov 30, 2012 3:58 am
Ouch, that means your stack is not aligned. If your system/compiler cannot guarantee and aligned stack, then compiling with -DEIGEN_DONT_ALIGN_STATICALLY is your only option.

I guess your are using mingw, or perhaps have a multi-threaded application?
lquack
Registered Member
Posts
3
Karma
0

Re: Eigen::DontAlign

Mon Dec 03, 2012 12:24 pm
ggael wrote:Ouch, that means your stack is not aligned. If your system/compiler cannot guarantee and aligned stack, then compiling with -DEIGEN_DONT_ALIGN_STATICALLY is your only option.
Are you sure? I admit that I don't fully grasp the root of the problem, but if I simply use
Code: Select all
Eigen::Quaternion<double, Eigen::DontAlign>(1,0,0,0);
instead of
Code: Select all
Eigen::Quaternion<double, Eigen::DontAlign>::Identity();
it seems to work. That's why I think it is a bug in Eigen that the Quaternion doesn't correctly respect the options when returning a newly create instance.
Specifically I think Line 105 in Quaternion.h (and other places) should be something like this (untested):
Code: Select all
static inline QuaternionBase<Derived> Identity() { return QuaternionBase<Derived>(1, 0, 0, 0); }


ggael wrote:I guess your are using mingw, or perhaps have a multi-threaded application?
Yes, to both.

Thanks again for your time!


Bookmarks



Who is online

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