[Numpy-discussion] Howto vectorise a dot product ?
Charles R Harris
Wed Jun 10 11:59:36 CDT 2009
On Wed, Jun 10, 2009 at 12:21 AM, bruno Piguet <email@example.com>wrote:
> 2009/6/9 Charles R Harris <firstname.lastname@example.org>
>> Well, in this case you can use complex multiplication and either work with
>> just the x,y components or use two complex components, i.e., [x + 1j*y, z].
>> In the first case you can then do the rotation as V*exp(1j*phi).
> In the real case, it's a real 3-axes rotation, where M = dot (M1(psi), dot
> (M2(theta), M3(phi))). The decomposition in 2D-rotations and the use of
> complex operation is possible, but the matrix notation is more concise.
> If you want more general rotations, a ufunc for quaternions would do the
> You mean something like Christoph Gohlke's "transformations.py" program ?
I don't know. But I think generating the rotation matrices is likely to be
the bottleneck and I'm not sure how you want to specify them. After you have
the stack of rotation matrices there are at least three ways to multiply
them with stacks of vectors: in a python loop, using newaxis and a sum, or
possibly a generalized ufunc. I'm not sure about the latter but I think
there is an example that does that.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Numpy-discussion