[Numpy-discussion] Row-wise dot product?

Nadav Horesh nadavh@visionsense....
Mon Sep 7 04:56:33 CDT 2009


(x*y).sum(1)

  Nadav


-----הודעה מקורית-----
מאת: numpy-discussion-bounces@scipy.org בשם T J
נשלח: ב 07-ספטמבר-09 12:34
אל: Discussion of Numerical Python
נושא: [Numpy-discussion] Row-wise dot product?
 
Is there a better way to achieve the following, perhaps without the
python for loop?

>>> x.shape
(10000,3)
>>> y.shape
(10000,3)
>>> z = empty(len(x))
>>> for i in range(10000):
...    z[i] = dot(x[i], y[i])
...
_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion



More information about the NumPy-Discussion mailing list