Re: [eigen] Issues regarding Quaternion-alignment and const Maps

[ Thread Index | Date Index | More Archives ]

Christoph Hertzberg wrote:
Gael Guennebaud wrote:
On Wed, Jul 7, 2010 at 9:56 AM, Christoph Hertzberg
<chtz@xxxxxxxxxxxxxxxxxxxxxxxx> wrote:

first of all great work, everyone!

I have two issues with Eigen2, which I'm not sure Eigen3 has solved/will
solve (I did look at the new source, but might have overlooked something).

First, I guess there is no (easy) possibility to have an not-aligned
quaternion (without disabling alignment globally).
For ordanary matrices there is a Eigen::DontAlign option, which I haven't
found for Quaternions. And currently I don't see a very lot of gain in
vectorization of Quaternions, especially (quaternion * vector3) is not
vectorized, and (quaternion * quaternion) only for float (at least in

With Eigen3 you can map unaligned data as a Quaternion, but that's
less convenient. So you would like a DontAlign option, e.g.:


Then we should also add such an option to Translation and Transform.

Why not.

I implemented it for Quaternions. Once I dug through all the code it wasn't even that hard ...

I'm not entirely sure if

  typedef Quaternion<_Scalar, PacketAccess> PlainObject;

in struct ei_traits<Quaternion<_Scalar, _PacketAccess> >

actually needs to have the same PacketAccess (as far as I looked, it was not used anywhere ...)

Patch is attached.

Hm, everything I tried was running, but I didn't actually look at the
generated assembler. Using this patch it never generates SSE optimized
multiplication ...

Seems like I misunderstood PacketAccess vs Options.
If I see it correct now, I have to name the template parameter Options,
and make the enum PacketAccess within the traits be Unaligned or Aligned
depending on DontAlign being set in Options of Quaternion.
Before I make the next patch, could someone confirm this?
And another question: Do I have to make sure, that no Options besides
DontAlign can be set? (Would it actually matter if someone decides to
have a RowMajor Quaternion?)


Dipl.-Inf. Christoph Hertzberg
Cartesium 0.051
Universität Bremen
Enrique-Schmidt-Straße 5
28359 Bremen

Tel: (+49) 421-218-64252

Mail converted by MHonArc 2.6.19+