[Numpy-discussion] Howto vectorise a dot product ?
bruno Piguet
bruno.piguet at gmail.com
Wed Jun 10 02:21:07 EDT 2009
2009/6/9 Charles R Harris <charlesr.harris at 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'll also chek if I really ned vectorisation. After all, Numpy slicing is
known to be efficient.
I'll do some timing with the pseudo-vectorial function :
def rotat_vect(phi, theta, psi, V):
for i in xrange(len(phi)):
rotat_scal(phi[i,:], theta[i,:], psi[i,:], V[i,:])
Bruno.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20090610/ca741962/attachment.html>
More information about the NumPy-Discussion
mailing list