[Numpy-discussion] cross product of two 3xn arrays
Charles R Harris
charlesr.harris at gmail.com
Fri Feb 17 08:23:06 CST 2006
On 2/17/06, Bill Baxter <wbaxter at gmail.com> wrote:
> For folks using quats to represent rotations (which is all I use them for,
> anyway), if you're batch transforming a bunch of vectors by one quaternion,
> it's a lot more efficient to convert the quat to a 3x3 matrix first and
> transform using matrix multiply (9 mults per transform that way vs 21 or so
> depending on the implementation of q*v*q^-1). Given that, I can't see many
> situations when I'd need a super speedy C version of quaternion multiply.
>
> --Bill
True. On the other hand, I have files containing 20,000 quaternions,
each of which needs to be converted to a rotation matrix and applied
to some 400 vectors, so a c version would have its place. I have a
python quaternion class that I use for such things but profiling shows
that it is one of the prime time bandits, so I am tempted to use c for
that class anyway. Note that the current NumPy cross product is
implemented in Python.
On a related note, indexing in numarray is some 3x faster than in
NumPy and I'm wondering what needs to be done to speed that up.
Chuck
More information about the Numpy-discussion
mailing list