[Numpy-tickets] [NumPy] #588: numpy.dot() doesn't work correctly on non-contingous arrays

NumPy numpy-tickets@scipy....
Mon Oct 8 12:46:08 CDT 2007


#588: numpy.dot() doesn't work correctly on non-contingous arrays
------------------------+---------------------------------------------------
 Reporter:  robince     |       Owner:  somebody
     Type:  defect      |      Status:  new     
 Priority:  normal      |   Milestone:          
Component:  numpy.core  |     Version:  devel   
 Severity:  major       |    Keywords:          
------------------------+---------------------------------------------------
 Using dot() with non-contigous arrays doesn't work correctly.


 Example:

 In [1]: from numpy import *

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

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

 In [4]: z=array([[1024.],[1280.],[640.],[160.],[20.]])

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

 In [6]: y2-z
 Out[6]:
 array([[ 0.],
        [ 0.],
        [ 0.],
        [ 0.],
        [ 0.]])

 In [8]: dot(x,z)
 Out[8]: array([[ 55924.]])

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

 In [10]: dot(x,array(y2))
 Out[10]: array([[ 55924.]])

 In [11]: __version__
 Out[11]: '1.0.4.dev4155'



 Perhaps a test could be added to try and catch this type of problem
 (testing core functions with non-contigous arrays).

-- 
Ticket URL: <http://scipy.org/scipy/numpy/ticket/588>
NumPy <http://projects.scipy.org/scipy/numpy>
The fundamental package needed for scientific computing with Python.


More information about the Numpy-tickets mailing list