|Re: [eigen] Patch for quaternion normalization and cross product for Vector4f|
[ Thread Index |
| More lists.tuxfamily.org/eigen Archives
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] Patch for quaternion normalization and cross product for Vector4f
- From: Benoit Jacob <jacob.benoit.1@xxxxxxxxx>
- Date: Wed, 11 Mar 2009 07:58:48 -0400
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=qK+npilHI8xc9JG//fjJmrmQ+BBeRWy8ZbgOCBVadeI=; b=p3VThVG/0YX7X8kR+VJCKdft8LJcDkPolL6DKYtqNzK1/RaWGTCdTU2mSxUwODs5cp u6Db+1CFtWxlWXwezENrqYdZ23fMG25FRYnoZr/lw+BK8ZCDESgw7aFqcBqgFLMUsqTD VVy/HKQxjwz/G7ckU3p57zNEVjbOXmDT6QKrQ=
- 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=vdH3GWYyD/F6wfgH54zSwF8Cw1yq+z3KJUTJ+MmgNI/NBRfk5e7WzAXEv1nsnaSNeE C8cjozhT5gnQ/dks8ymvGtctEppZT8j3kPOhTLkzyTs28t36FdtllKyJvp8/0TrUuKnQ nsXQIzWFP4GYIVPp98GWOmK78afyxm9UQWEdo=
2009/3/11 Rohit Garg <rpg.314@xxxxxxxxx>:
>> yes that's true that AoS is more convenient, and I agree it might be
>> handy to have an optimized cross3. Honestly, when dealing with such
>> small vectors, if your code includes many dot/cross products,
>> normalizations, etc... then I doubt the speed up could be above x1.5.
>> Significant speedup can only come from a more high level
>> reorganization of your algorithm, and using complex memory layouts...
> Yes, but the problem is that many api's (like opengl for instance)
> like AoS input form. And 1.5x is any day better than 1x. :) And we
> _do_ have vectorized dot's, add, mul, normalize, subtract etc. for
> small vectors in eigen, don't we?
For fixed-size vectors, we have vectorization only if we can have it
without runtime overhead, which is only if we can align the array
without wasting memory, which is only if the size is a multiple of 16
bytes. So Vector4f yes, but Vector3f no.
For dynamic sizes (typically larger), we have vectorization regardless
of the size.
> Bottom line, what is the reason for such a function not being part of
> the eigen's api when almost all the family of vector ops is? After
> all, it only improves speed. :/ And it's an opt-in feature, not an
> opt-out one.
About the cross product:
I can't make myself a strong opinion either way. I was concerned of
maintainance and porting to other archs, but it seems to factor well
through our wrappers. My main concern now is that it's going to be
little used. On the other hand, it could be the first of a collection
of functions working on 3d vectors stored as 4d vectors for
vectorization; I would be OK to start a new subdirectory of
unsupported/ containing such functions. After all there is a demand
for such functions, but they fit poorly with the rest of Eigen (until
perhaps we find a better API -- one possibility might be to have a
variant of the Matrix class itself doing storage differently and
reimplementing these methods) and put a much bigger burden of the user
to take care of low-level aspects, but in unsupported/ that's ok.
Your patch also contains a vectorized quaternion product. That would
be extremely useful, I wonder why you dont mention it in your email?
Do you consider it unfinished? I may also be out of date if Gael
vectorized it already since the last time I checked.....
>> Regarding Bullet SDK, actually only some specific parts of the SDK are
>> vectorized by hand (using directly inline assembly and/or using
>> directly intrinsics) and there the base classes (matrix, vector) are
>> not vectorized at all.
> Rohit Garg
> Senior Undergraduate
> Department of Physics
> Indian Institute of Technology