some docs improvements

This commit is contained in:
Benoit Jacob 2009-07-05 01:52:42 +02:00
parent c398d0edcf
commit 60467e54a5
2 changed files with 15 additions and 15 deletions

View File

@ -88,7 +88,7 @@ The solution is to let class Foo have an aligned "operator new", as we showed in
\section movetotop Should I then put all the members of Eigen types at the beginning of my class?
No, that's not needed. Since Eigen takes care of declaring 128-bit alignment, all members that need it are automatically 128-bit aligned relatively to the class. So when you have code like
That's not required. Since Eigen takes care of declaring 128-bit alignment, all members that need it are automatically 128-bit aligned relatively to the class. So code like this works fine:
\code
class Foo
@ -100,25 +100,13 @@ public:
};
\endcode
it will work just fine. You do \b not need to rewrite it as
\code
class Foo
{
Eigen::Vector2d v;
double x;
public:
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
};
\endcode
\section dynamicsize What about dynamic-size matrices and vectors?
Dynamic-size matrices and vectors, such as Eigen::VectorXd, allocate dynamically their own array of coefficients, so they take care of requiring absolute alignment automatically. So they don't cause this issue. The issue discussed here is only with fixed-size matrices and vectors.
Dynamic-size matrices and vectors, such as Eigen::VectorXd, allocate dynamically their own array of coefficients, so they take care of requiring absolute alignment automatically. So they don't cause this issue. The issue discussed here is only with \ref FixedSizeVectorizable "fixed-size vectorizable matrices and vectors".
\section bugineigen So is this a bug in Eigen?
No, it's not our bug. It's more like an inherent problem of the C++ language -- though it must be said that any other existing language probably has the same problem. The problem is that there is no way that you can specify an aligned "operator new" that would propagate to classes having you as member data.
No, it's not our bug. It's more like an inherent problem of the C++98 language specification, and seems to be taken care of in the upcoming language revision: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2341.pdf">see this document</a>.
\section conditional What if I want to do this conditionnally (depending on template parameters) ?

View File

@ -15,12 +15,24 @@ is explained here: http://eigen.tuxfamily.org/dox/UnalignedArrayAssert.html
There are 4 known causes for this issue. Please read on to understand them and learn how to fix them.
\b Table \b of \b contents
- \ref where
- \ref c1
- \ref c2
- \ref c3
- \ref c4
- \ref explanation
\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.
\section c1 Cause 1: Structures having Eigen objects as members
If you have code like this,