[Numpy-discussion] Taking a large number of dot products at once
Daniel Hyams
dhyams@gmail....
Fri Mar 4 00:19:45 CST 2011
This is probably so easy, I'm embarrassed to ask it...but I've been casting
around trying things to no avail for the last hour and a half, so here
goes...
I have a lot of dot products to take. The length-3 vectors that I want to
dot are stacked in a 2D array like this:
U = [u1 u2 u3....]
and
V = [v1 v2 v3....]
So both of these arrays, are, say, 3x100 each. I just want to take the dot
product of each of the corresponding vectors, so that the result is
[u1.v1 u2.v2 u3.v3 ....]
which would be a 1x100 array in this case.
Which function do I need to use? I thought tensordot() was the one, but I
couldn't make it work....pure user error I'm sure.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20110304/504fc126/attachment.html
More information about the NumPy-Discussion
mailing list