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

Bruce Southey bsouthey@gmail....
Fri Jul 10 08:28:07 CDT 2009


>
> hey,
>
> great man! thanks!
>
> I had thought that it may have been possible with a single dot, but
> how to do it escaped me.
>
> Thanks again!
>
> Chris
>    
Hi,
When dot is not what you want, often numpy.inner() and numpy.outer() do 
what you want.
So try using numpy.inner(x,y)...
http://www.scipy.org/Numpy_Example_List_With_Doc#inner

import numpy as np
x = np.random.rand(10,4)
y = np.random.rand(4,4)
print 'x\n', x, '\ny\n', y
print '\nresult\n',  np.dot(y,x.T).T
print '\ninner\n', np.inner(x,y)



Bruce







More information about the NumPy-Discussion mailing list