Any idea to run the dot-product on many arrays
Hi, I need to rotate many vectors (x,y,z) with a given rotation matrix (3x3). I can always do for v in vectors: tv += np.dot(mat, v) where mat is my fixed matrix (or array of arrays) and v is a single array. Is there any efficient way to use an array of vectors to do the transfomation for all of these vectors at once? Kind regards Thomas This email and any attachments are intended solely for the use of the individual or entity to whom it is addressed and may be confidential and/or privileged. If you are not one of the named recipients or have received this email in error, (i) you should not read, disclose, or copy it, (ii) please notify sender of your receipt by reply email and delete this email and all attachments, (iii) Dassault Systemes does not accept or assume any liability or responsibility for any use of or reliance on this email.For other languages, go to http://www.3ds.com/terms/email-disclaimer.
On 01/13/2011 05:04 PM, EMMEL Thomas wrote:
Hi,
I need to rotate many vectors (x,y,z) with a given rotation matrix (3x3). I can always do
for v in vectors: tv += np.dot(mat, v)
where mat is my fixed matrix (or array of arrays) and v is a single array. Is there any efficient way to use an array of vectors to do the transfomation for all of these vectors at once?
numpy.dot(rotationmatrix , coordinates.T).T Where coordinates is a n*3 matrix of n stacked vectors in rows. It works with vectors stacked in column without the the two transpose. It's even possible to apply a symmetry operation to a bunch of second rank tensors in one go. Pascal
participants (2)
-
EMMEL Thomas
-
Pascal