[Numpy-discussion] transform an array of points efficiently?

Chris Colbert sccolbert@gmail....
Thu Jul 9 21:08:56 CDT 2009


say i have an Nx4 array of points and I want to dot every [n, :] 1x4
slice with a 4x4 matrix.

Currently I am using apply_along_axis in the following manner:

def func(slice, mat):
     return np.dot(mat, slice)

np.apply_along_axis(func, arr, 1, mat)

Is there a more efficient way of doing this that doesn't require a
python function for each slice?

Cheers,

Chris


More information about the NumPy-Discussion mailing list