[Numpy-discussion] Howto vectorise a dot product ?
Charles R Harris
charlesr.harris@gmail....
Wed Jun 10 11:59:36 CDT 2009
On Wed, Jun 10, 2009 at 12:21 AM, bruno Piguet <bruno.piguet@gmail.com>wrote:
> 2009/6/9 Charles R Harris <charlesr.harris@gmail.com>
>
>>
>> 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
>> trick.
>>
>
> 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.
Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20090610/0e6c8a6a/attachment.html
More information about the Numpy-discussion
mailing list