[Numpy-discussion] Matrices and arrays of vectors

Pierre Haessig pierre.haessig@crans....
Fri Feb 24 07:06:53 CST 2012

Le 24/02/2012 13:55, Nicolas Rougier a écrit :
> You should use a (M,N,2) array to store your vectors:
> [...]
> [...]
> numpy.dot(data,rotation)
looking at how numpy.dot generalizes the matrix product* to N-dim
arrays, I came to the same conclusion.

I just suspect that the 'rotation' array should be transposed. (or flip
the sign of theta which is equivalent...)


* from numpy.dot docstring :
dot(a, b) Dot product of two arrays.

For N dimensions it is a sum product over the *last* axis of `a` and
the *second-to-last* of `b`::

    dot(a, b)[i,j,k,m] = sum(a[i,j,:] * b[k,:,m])

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 900 bytes
Desc: OpenPGP digital signature
Url : http://mail.scipy.org/pipermail/numpy-discussion/attachments/20120224/e9f45708/attachment.bin 

More information about the NumPy-Discussion mailing list