[Numpy-discussion] Taking a large number of dot products at once
sturla at molden.no
Fri Mar 4 09:01:49 EST 2011
Den 04.03.2011 14:55, skrev Sturla Molden:
> We can do this with Python lists of NumPy arrays as well, avoiding
> stacking the arrays in a 2D structure:
> [np.dot(u,v.T) for u,v in zip(U,V)]
Damn it, bad style. Inner product, not outer...
[np.dot(u.T,v) for u,v in zip(U,V)]
[np.dot(u,v) for u,v in zip(U,V)]
While it does not matter for 1D vectors, it would for rank 1 x n matrices.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the NumPy-Discussion