[Numpy-discussion] allclose changed behaviour in 1.6.2 ?

Martin Raspaud martin.raspaud@smhi...
Fri Nov 30 02:07:11 CST 2012


Hi,

We noticed that comparing arrays of different shapes with allclose
doesn't work anymore in numpy 1.6.2.

Is this a feature or a bug ? :)

See the output in both 1.6.1 and 1.6.2 at the end of this mail.

Best regards,
Martin

1.6.1::

 In [1]: import numpy as np

 In [2]: np.__version__
 Out[2]: '1.6.1'

 In [3]: a = np.array([1, 2, 3])

 In [4]: b = np.array([1, 2, 3, 4])

 In [5]: np.allclose(a, b)
 Out[5]: False


1.6.2::

 In[1]: import numpy as np

 In[2]: np.__version__
 Out[2]: '1.6.2'

 In [3]: a = np.array([1, 2, 3])

 In[4]: b = np.array([1, 2, 3, 4])

 In[5]: np.allclose(a, b)
 Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
   File
"/home/maarten/pytroll/local/lib/python2.7/site-packages/numpy-1.6.2-py2.7-linux-x86_64.egg/numpy/core/numeric.py",
line 1936, in allclose
     return all(less_equal(abs(x-y), atol + rtol * abs(y)))
 ValueError: operands could not be broadcast together with shapes (3) (4)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: martin_raspaud.vcf
Type: text/x-vcard
Size: 302 bytes
Desc: not available
Url : http://mail.scipy.org/pipermail/numpy-discussion/attachments/20121130/2ac51866/attachment.vcf 


More information about the NumPy-Discussion mailing list