I have a 2x2 rotation matrix and several vectors stored in a Nx2 array. Is there a way to rotate them all (i.e. multiply them all by the rotation matrix) at once?
I'm sure there is a numpy method for that, it's just not obvious.
import numpy as np
vectors = np.array( ( (1,1), (1,2), (2,2), (4,2) ) ) # 4 2D vectors
ang = np.radians(30)
m = np.array( ( (np.cos(ang), -np.sin(ang)),
(np.sin(ang), np.cos(ang)) )) # 2x2 rotation matrix
# rotate 1 vector:
m.dot(vectors[0,:])
# rotate all vectors at once??