Re: [eigen] UnalignedArrayAssert... |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] UnalignedArrayAssert...
- From: Benoit Jacob <jacob.benoit.1@xxxxxxxxx>
- Date: Mon, 6 Sep 2010 18:03:25 -0400
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=ukvPeD1YFn2MK/k/OGpjFyznDogZNPPUSOt4dj+gesg=; b=HCuJEhv9X5lLwIcpogtL7o3jgwAnkjnGSy/P9h3ANvzCYuGjn+Z6p8QCFW8n2r+JVR 1gh41aE8Rjs7s2l+DUzWDQW+hs6PnoGVSu1TMxQoMYSqgE8Y1/5wEMycA4nKpQIQulq+ asKOvVR9o2o3swC7kdR8IlZnw4M663kLd/h0k=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=A5FJwmHkwwe2QCeHyE+3y6Muqd7QkM92muVHum9lNIqz2OZINM8jcUerkBr2knJXrP 3JPPbWe4vVoIXGYD3htUq6rA2gsZrms6PMiYZGajG4Jk7/i3HO8fbvPZ654GRVBRMzpH CVGXzwiajx98qn8L+YkEMxS1Wb2TuCUNt1N9A=
2010/9/6 Matthias Pospiech <matthias.pospiech@xxxxxx>:
> I am lost with all the assert failures.
>
> I am using a 2x2 double matrix in such a class construct:
>
> #include <Core>
> USING_PART_OF_NAMESPACE_EIGEN
> typedef Matrix<double,2,2> MatrixABCD;
>
> class ABCDPrivate
> {
> public:
> MatrixABCD matrix;
>
> public:
> // necessary for EIGEN Libary
> EIGEN_MAKE_ALIGNED_OPERATOR_NEW
> };
>
> ABCD::ABCD()
> : d(new ABCDPrivate)
> {
> d->matrix.setIdentity();
> }
>
>
> this now seems to work.
>
> But then it fails here: ( Lens is derived public from ABCD)
> void Lens::setFocalLength(double focallength)
> {
> m_FocalLength = focallength;
>
> MatrixABCD matrix; <<--- failure
> matrix << 1.0 , 0.0, -1.0/m_FocalLength , 1.0;
>
> setMatrix(matrix);
> }
>
> why?
The only reason that I can think of, which the above would fail, is if
the compiler has a bug making it do wrong assumptions about stack
alignment.
http://eigen.tuxfamily.org/dox/WrongStackAlignment.html
as explained there, this was a GCC / Windows bug fixed in GCC 4.5.
>
> also I am using the class ABCD in a std::vector do I need to take special
> care of that?
Yes:
http://eigen.tuxfamily.org/dox/StlContainers.html
>
> This class collection is part of a workshop (next week) on programming for
> physicists and I wanted to
> use a decent matrix class instead of a simple self written class (which
> would be much easier to use
> and understand).
If this is just for educational purposes and you don't want to be
annoyed by these issues, just #define EIGEN_DONT_ALIGN. In Eigen3, you
can do better yet: EIGEN_DONT_ALIGN_STATICALLY solves the problem
while retaining vectorization for dynamic-size objects.
Benoit
>
> Matthias
>
>
>