my_program: path/to/eigen2/Eigen/src/Core/MatrixStorage.h:44: Eigen::ei_matrix_array<T, Size, MatrixOptions, Align>::ei_matrix_array() [with T = double, int Size = 2, int MatrixOptions = 2, bool Align = true]: Assertion `(reinterpret_cast<size_t>(array) & 0xf) == 0 && "this assertion is explained here: http://eigen.tuxfamily.org/dox/UnalignedArrayAssert.html READ THIS WEB PAGE !!! ****"' failed.
There are 3 known causes for this issue. Please read on to understand them and learn how to fix them.
Table of contents
class Foo { //... Eigen::Vector2d v; //... }; //... Foo *foo = new Foo;
then you need to read this separate page: Structures Having Eigen Members.
Note that here, Eigen::Vector2d is only used as an example, more generally the issue arises for all fixed-size vectorizable Eigen types.
std::vector<Eigen::Matrix2f> my_vector; std::map<int, Eigen::Matrix2f> my_map;
then you need to read this separate page: Using STL Containers with Eigen.
Note that here, Eigen::Matrix2f is only used as an example, more generally the issue arises for all fixed-size vectorizable Eigen types.
void func(Eigen::Vector4d v);
then you need to read this separate page: Passing Eigen objects by value to functions.
Note that here, Eigen::Vector4d is only used as an example, more generally the issue arises for all fixed-size vectorizable Eigen types.
Eigen normally takes care of these alignment issues for you, by setting an alignment attribute on them and by overloading their "operator new".
However there are a few corner cases where these alignment settings get overridden: they are the possible causes for this assertion.