Re: [eigen] Mapping array of scalars into quaternions

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]


+1 !

2009/10/26 Gael Guennebaud <gael.guennebaud@xxxxxxxxx>:
>
> Sorry I don't have much time to follow this development, but it seems that
> in the current patch QuaternionWrapper would be only to map a float* (or
> double*) as a Quaternion, right ? while other uses of "Wrapper" are to to
> wrap any expressions (including a Map<>) as something else (e.g. a
> DiagonalMatrix).
>
> So instead of QuaternionWrapper, what about using a specialization of Map
> for Quaternion:
>
> template<typename _Scalar, int Alignment>
> class Map<Quaternion<_Scalar>, Alignment> : public QuaternionBase<...>
> {
>  // current QuaternionWrapper's code goes here
> };
>
> User code would look like:
>
> float data[4];
> Map<Quaternionf,Aligned> q(data);
>
> Maybe this look more natural ?
>
> From a practical point of view, this requires to change only 1 or 2 lines in
> your patch.
>
>
>
>
> Then in the future we could still re-introduce QuaternionWrapper to actually
> wrap any expression as a Quaternion:
>
> template<XprType> class QuaternionWrapper : public QuaternionBase<...>
> {
> };
>
> Though I don't think that such a QuaternionWrapper is really needed, perhaps
> in the future... who knows.
>
> gael.
>
>
>
> On Mon, Oct 26, 2009 at 8:02 PM, Benoit Jacob <jacob.benoit.1@xxxxxxxxx>
> wrote:
>>
>> 2009/10/26 Mathieu Gautier <mathieu.gautier@xxxxxx>:
>> > Actually the multiplication of two quaternions is not vectorized? Are
>> > you
>> > refering to the version proposed by Rohit in the archives ?
>>
>> it is, for float. Check the specialization in
>> Eigen/src/Geometry/arch/Geometry_SSE.h.
>>
>> >
>> > As usual, I have some questions :) I don't understand the difference in
>> > your
>> > enum between :
>> >
>> >        enum { Unaligned=0, Aligned=1 };
>> > and     enum { AsRequested=0, EnforceAlignedAccess=2 };
>>
>> See Gael's explanations in the other thread. Aligned means that you
>> certify that the pointer that you pass to Map will be aligned.That's
>> what you want. EnforceAlignedAccess is a different thing, it's
>> internal, ignore it.
>>
>> >
>> > Aligned is used In map in test/map.cpp :
>> >
>> >        VectorType ma1 = Map<VectorType, Aligned>(array1, size);
>>
>> So here we are saying "array1 is an aligned pointer, feel free to use
>> that information when vectorizing the code".
>>
>> >
>> > and AsRequested is used in ForwardDeclarations.h as the default argument
>> > for
>> > PacketAccess.
>>
>> Well AsRequested is 0 anyway. To make things clear the default
>> argument could be explicitly 0 as it is always important that default
>> values of bitfields be 0, regardless of what they mean, so that one
>> doesnt have to OR with the default value when one just wants to change
>> 1 bit.
>>
>> >
>> > Does it means that "AsRequested" and "Unaligned" are equivalent ?
>>
>> This is a bit field, these 2 values represent the corresponding bit
>> being 0, but it's not the same bit.
>>
>> > Because I
>> > am actually not comfortable how to use PacketAccess and which value to
>> > provide to QuaternionWrapper.
>>
>> In case of an aligned pointer, pass Aligned to Map.
>> Otherwise, pass 0 to Map.
>>
>> I havent yet checked your new patch. if you could send a unique
>> combined patch (see other mail) that would help. Also tell me if after
>> these answers there are changes that you want to make before i
>> reexamine the code.
>>
>> Benoit
>>
>
>



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/