[Numpy-discussion] dot product not behaving as expected
Robin
robince at gmail.com
Mon Oct 8 12:32:43 EDT 2007
Hi,
I have a problem using numpy.dot, see below:
In [151]: m=5
In [152]: n=5
In [153]: x=(m*ones((1,5)))**arange(0,n)
In [154]: y=test.order_length[::-1]
In [155]: x
Out[155]: array([[ 1., 5., 25., 125., 625.]])
In [156]: y
Out[156]:
array([[ 1024.],
[ 1280.],
[ 640.],
[ 160.],
[ 20.]])
In [157]: numpy.dot(x,y)
Out[157]: array([[ 640000.]])
In [158]: sum(x*y.T)
Out[158]: 55924.0
Am I missing something?
Thanks,
Robin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20071008/124f470c/attachment.html>
More information about the NumPy-Discussion
mailing list