Difference between revisions of "Pit Falls"

From Eigen
Jump to: navigation, search
(Alignment Issues (runtime assertion))
(Alignment Issues (runtime assertion))
Line 9: Line 9:
 
Have a look at it and see for yourself if that's something that you can cope with. It contains detailed information about how to deal with each known cause for that issue.
 
Have a look at it and see for yourself if that's something that you can cope with. It contains detailed information about how to deal with each known cause for that issue.
  
 +
=== Avoiding Alignment Assertions ===
 
Now what if you don't care about vectorization and so don't want to be annoyed with these alignment issues? Then you can easily [[FAQ#I_disabled_vectorization.2C_but_I.27m_still_getting_annoyed_about_alignment_issues.21|get rid of them]].
 
Now what if you don't care about vectorization and so don't want to be annoyed with these alignment issues? Then you can easily [[FAQ#I_disabled_vectorization.2C_but_I.27m_still_getting_annoyed_about_alignment_issues.21|get rid of them]].
  

Revision as of 05:48, 21 September 2009

Pit Falls

Alignment Issues (runtime assertion)

Eigen does explicit vectorization, and while that is appreciated by many users, that also leads to some issues in special situations where data alignment is compromised. Indeed, C++98 doesn't have quite good enough support for explicit data alignment (that's coming in C++1x). In that case your program hits an assertion failure (that is, a "controlled crash") with a message that tells you to consult this page:

 http://eigen.tuxfamily.org/dox/UnalignedArrayAssert.html

Have a look at it and see for yourself if that's something that you can cope with. It contains detailed information about how to deal with each known cause for that issue.

Avoiding Alignment Assertions

Now what if you don't care about vectorization and so don't want to be annoyed with these alignment issues? Then you can easily get rid of them.

Header Issues (failure to compile)

With all libraries, one must check the documentation for which header to include. The same is true with Eigen, but worse: with Eigen, a method in a class may require an additional #include over what the class itself requires! For example, if you want to use the cross() method on a vector (it computes a cross-product) then you need to

 #include<Eigen/Geometry>

We try to always document this, but do tell us if we forgot an occurence.