2008-12-08 00:31:32 +08:00
namespace Eigen {
Big changes in Eigen documentation:
- Organize the documentation into "chapters".
- Each chapter include many documentation pages, reference pages organized as modules, and a quick reference page.
- The "Chapters" tree is created using the defgroup/ingroup mechanism, even for the documentation pages (i.e., .dox files for which I added an \eigenManualPage macro that we can switch between \page or \defgroup ).
- Add a "General topics" entry for all pages that do not fit well in the previous "chapters".
- The highlevel struture is managed by a new eigendoxy_layout.xml file.
- remove the "index" and quite useless pages (namespace list, class hierarchy, member list, file list, etc.)
- add the javascript search-engine.
- add the "treeview" panel.
- remove \tableofcontents (replace them by a custom \eigenAutoToc macro to be able to easily re-enable if needed).
- add javascript to automatically generate a TOC from the h1/h2 tags of the current page, and put the TOC in the left side panel.
- overload various javascript function generated by doxygen to:
- remove the root of the treeview
- remove links to section/subsection from the treeview
- automatically expand the "Chapters" section
- automatically expand the current section
- adjust the height of the treeview to take into account the TOC
- always use the default .css file, eigendoxy.css now only includes our modifications
- use Doxyfile to specify our logo
- remove cross references to unsupported modules (temporarily)
2013-01-05 23:37:11 +08:00
/** \eigenManualPage TopicUnalignedArrayAssert Explanation of the assertion on unaligned arrays
2008-12-08 00:31:32 +08:00
2009-01-12 22:41:12 +08:00
Hello! You are seeing this webpage because your program terminated on an assertion failure like this one:
<pre>
2010-10-20 21:34:13 +08:00
my_program: path/to/eigen/Eigen/src/Core/DenseStorage.h:44:
2010-10-25 22:15:22 +08:00
Eigen::internal::matrix_array<T, Size, MatrixOptions, Align>::internal::matrix_array()
2009-01-12 22:41:12 +08:00
[with T = double, int Size = 2, int MatrixOptions = 2, bool Align = true]:
Assertion `(reinterpret_cast<size_t>(array) & 0xf) == 0 && "this assertion
2009-02-02 22:21:35 +08:00
is explained here: http://eigen.tuxfamily.org/dox/UnalignedArrayAssert.html
2009-01-12 22:41:12 +08:00
**** READ THIS WEB PAGE !!! ****"' failed.
</pre>
2009-06-21 23:25:57 +08:00
There are 4 known causes for this issue. Please read on to understand them and learn how to fix them.
2008-12-08 00:31:32 +08:00
Big changes in Eigen documentation:
- Organize the documentation into "chapters".
- Each chapter include many documentation pages, reference pages organized as modules, and a quick reference page.
- The "Chapters" tree is created using the defgroup/ingroup mechanism, even for the documentation pages (i.e., .dox files for which I added an \eigenManualPage macro that we can switch between \page or \defgroup ).
- Add a "General topics" entry for all pages that do not fit well in the previous "chapters".
- The highlevel struture is managed by a new eigendoxy_layout.xml file.
- remove the "index" and quite useless pages (namespace list, class hierarchy, member list, file list, etc.)
- add the javascript search-engine.
- add the "treeview" panel.
- remove \tableofcontents (replace them by a custom \eigenAutoToc macro to be able to easily re-enable if needed).
- add javascript to automatically generate a TOC from the h1/h2 tags of the current page, and put the TOC in the left side panel.
- overload various javascript function generated by doxygen to:
- remove the root of the treeview
- remove links to section/subsection from the treeview
- automatically expand the "Chapters" section
- automatically expand the current section
- adjust the height of the treeview to take into account the TOC
- always use the default .css file, eigendoxy.css now only includes our modifications
- use Doxyfile to specify our logo
- remove cross references to unsupported modules (temporarily)
2013-01-05 23:37:11 +08:00
\eigenAutoToc
2008-12-08 00:31:32 +08:00
2009-07-05 07:52:42 +08:00
\section where Where in my own code is the cause of the problem?
First of all, you need to find out where in your own code this assertion was triggered from. At first glance, the error message doesn't look helpful, as it refers to a file inside Eigen! However, since your program crashed, if you can reproduce the crash, you can get a backtrace using any debugger. For example, if you're using GCC, you can use the GDB debugger as follows:
\code
$ gdb ./my_program # Start GDB on your program
> run # Start running your program
... # Now reproduce the crash!
> bt # Obtain the backtrace
\endcode
Now that you know precisely where in your own code the problem is happening, read on to understand what you need to change.
2009-01-12 22:41:12 +08:00
\section c1 Cause 1: Structures having Eigen objects as members
2008-12-08 00:31:32 +08:00
2009-01-12 22:41:12 +08:00
If you have code like this,
2008-12-08 00:31:32 +08:00
\code
2009-01-06 02:21:44 +08:00
class Foo
2008-12-08 00:31:32 +08:00
{
2009-01-12 22:41:12 +08:00
//...
2008-12-08 00:31:32 +08:00
Eigen::Vector2d v;
2009-01-12 22:41:12 +08:00
//...
2008-12-08 00:31:32 +08:00
};
2009-01-12 22:41:12 +08:00
//...
2008-12-08 00:31:32 +08:00
Foo *foo = new Foo;
\endcode
2010-07-04 16:14:47 +08:00
then you need to read this separate page: \ref TopicStructHavingEigenMembers "Structures Having Eigen Members".
2009-01-06 11:16:50 +08:00
2010-07-04 16:14:47 +08:00
Note that here, Eigen::Vector2d is only used as an example, more generally the issue arises for all \ref TopicFixedSizeVectorizable "fixed-size vectorizable Eigen types".
2009-01-06 11:16:50 +08:00
2009-01-12 22:41:12 +08:00
\section c2 Cause 2: STL Containers
2009-01-06 11:16:50 +08:00
2010-01-03 01:55:32 +08:00
If you use STL Containers such as std::vector, std::map, ..., with Eigen objects, or with classes containing Eigen objects, like this,
2009-01-06 11:16:50 +08:00
\code
2009-01-12 22:41:12 +08:00
std::vector<Eigen::Matrix2f> my_vector;
2010-01-03 01:55:32 +08:00
struct my_class { ... Eigen::Matrix2f m; ... };
std::map<int, my_class> my_map;
2009-01-06 11:16:50 +08:00
\endcode
2010-07-04 16:14:47 +08:00
then you need to read this separate page: \ref TopicStlContainers "Using STL Containers with Eigen".
2009-01-06 11:16:50 +08:00
2010-07-04 16:14:47 +08:00
Note that here, Eigen::Matrix2f is only used as an example, more generally the issue arises for all \ref TopicFixedSizeVectorizable "fixed-size vectorizable Eigen types" and \ref TopicStructHavingEigenMembers "structures having such Eigen objects as member".
2009-01-06 11:16:50 +08:00
2009-01-12 22:41:12 +08:00
\section c3 Cause 3: Passing Eigen objects by value
2008-12-08 00:31:32 +08:00
2009-01-12 22:41:12 +08:00
If some function in your code is getting an Eigen object passed by value, like this,
2008-12-08 00:31:32 +08:00
\code
2009-01-12 22:41:12 +08:00
void func(Eigen::Vector4d v);
2008-12-08 00:31:32 +08:00
\endcode
2010-07-04 16:14:47 +08:00
then you need to read this separate page: \ref TopicPassingByValue "Passing Eigen objects by value to functions".
2008-12-08 00:31:32 +08:00
2010-07-04 16:14:47 +08:00
Note that here, Eigen::Vector4d is only used as an example, more generally the issue arises for all \ref TopicFixedSizeVectorizable "fixed-size vectorizable Eigen types".
2008-12-08 00:31:32 +08:00
2009-06-21 23:25:57 +08:00
\section c4 Cause 4: Compiler making a wrong assumption on stack alignment (for instance GCC on Windows)
This is a must-read for people using GCC on Windows (like MinGW or TDM-GCC). If you have this assertion failure in an innocent function declaring a local variable like this:
\code
void foo()
{
Eigen::Quaternionf q;
//...
}
\endcode
2010-07-04 16:14:47 +08:00
then you need to read this separate page: \ref TopicWrongStackAlignment "Compiler making a wrong assumption on stack alignment".
2009-06-21 23:25:57 +08:00
2010-07-04 16:14:47 +08:00
Note that here, Eigen::Quaternionf is only used as an example, more generally the issue arises for all \ref TopicFixedSizeVectorizable "fixed-size vectorizable Eigen types".
2009-06-21 23:25:57 +08:00
2009-01-12 22:41:12 +08:00
\section explanation General explanation of this assertion
2008-12-08 00:31:32 +08:00
2010-07-04 16:14:47 +08:00
\ref TopicFixedSizeVectorizable "fixed-size vectorizable Eigen objects" must absolutely be created at 16-byte-aligned locations, otherwise SIMD instructions adressing them will crash.
2008-12-08 00:31:32 +08:00
2009-01-12 22:41:12 +08:00
Eigen normally takes care of these alignment issues for you, by setting an alignment attribute on them and by overloading their "operator new".
2009-01-06 11:16:50 +08:00
2009-01-12 22:41:12 +08:00
However there are a few corner cases where these alignment settings get overridden: they are the possible causes for this assertion.
2009-01-06 11:16:50 +08:00
2009-09-19 10:01:49 +08:00
\section getrid I don't care about vectorization, how do I get rid of that stuff?
Two possibilities:
<ul>
2010-03-06 22:05:15 +08:00
<li>Define EIGEN_DONT_ALIGN_STATICALLY. That disables all 128-bit static alignment code, while keeping 128-bit heap alignment. This has the effect of
disabling vectorization for fixed-size objects (like Matrix4d) while keeping vectorization of dynamic-size objects
(like MatrixXd). But do note that this breaks ABI compatibility with the default behavior of 128-bit static alignment.</li>
<li>Or define both EIGEN_DONT_VECTORIZE and EIGEN_DISABLE_UNALIGNED_ARRAY_ASSERT. This keeps the
128-bit alignment code and thus preserves ABI compatibility, but completely disables vectorization.</li>
2009-09-19 10:01:49 +08:00
</ul>
For more information, see <a href="http://eigen.tuxfamily.org/index.php?title=FAQ#I_disabled_vectorization.2C_but_I.27m_still_getting_annoyed_about_alignment_issues.21">this FAQ</a>.
2008-12-08 00:31:32 +08:00
*/
}