[Numpy-discussion] dot product not behaving as expected

Robin robince at gmail.com
Mon Oct 8 12:57:37 EDT 2007


>
> It works for me with a recent SVN numpy on OS X. What version of numpy are
> you
> using? What platform are you on? Did you build with ATLAS or other
> optimized
> linear algebra library?


I am on Ubuntu 7.04, gcc 4.1.2

In [181]: numpy.__version__
Out[181]: '1.0.4.dev4155'

Built with ATLAS 3.7.37, Lapack 3.1.1

It also occurs for me on Windows XP SP2 with 1.0.4dev4154 built with cygwin
gcc 3.4.4 and atlas 3.7.37 and lapack 3.1.1.

Actually I found that for me it also doesn't occur if I type them in like
that. The problem comes when y is reverse with the [::-1] index. Is this the
correct way to reverse a vector?

Anyway try this:

In [36]: x=array([[1.,5.,25.,125.,625.]])

In [37]: y=array([[20.],[160.],[640.],[1280.],[1024.]])

In [38]: y
Out[38]:
array([[   20.],
       [  160.],
       [  640.],
       [ 1280.],
       [ 1024.]])

In [39]: y2=y[::-1]

In [40]: y2
Out[40]:
array([[ 1024.],
       [ 1280.],
       [  640.],
       [  160.],
       [   20.]])

In [41]: dot(x,y)
Out[41]: array([[ 816820.]])

In [42]: dot(x,y2)
Out[42]: array([[ 640000.]])

Thanks,

Robin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20071008/c6397763/attachment.html>


More information about the NumPy-Discussion mailing list