[Numpy-svn] r3799 - trunk/numpy/core

numpy-svn at scipy.org numpy-svn at scipy.org
Tue May 22 05:18:45 EDT 2007


Author: oliphant
Date: 2007-05-22 04:18:38 -0500 (Tue, 22 May 2007)
New Revision: 3799

Modified:
   trunk/numpy/core/numeric.py
Log:
Fix scalar inf comparison in allclose.

Modified: trunk/numpy/core/numeric.py
===================================================================
--- trunk/numpy/core/numeric.py	2007-05-22 06:25:44 UTC (rev 3798)
+++ trunk/numpy/core/numeric.py	2007-05-22 09:18:38 UTC (rev 3799)
@@ -818,10 +818,10 @@
     a = array([1]+n*[0],dtype=dtype)
     b = empty((n,n),dtype=dtype)
 
-    # Note that this assignment depends on the convention that since the a array
-    # is shorter than the flattened b array, then the a array will be repeated
-    # until it is the appropriate size. Given a's construction, this nicely sets
-    # the diagonal to all ones.
+    # Note that this assignment depends on the convention that since the a
+    # array is shorter than the flattened b array, then the a array will
+    # be repeated until it is the appropriate size. Given a's construction,
+    # this nicely sets the diagonal to all ones.
     b.flat = a
     return b
 
@@ -840,11 +840,12 @@
     yinf = isinf(y)
     if (not xinf.any() and not yinf.any()):
         return d1.all()
-    d2 = (xinf != yinf)
     d3 = (x[xinf] == y[yinf])
     d4 = (~xinf & ~yinf)
-    if d3.size == 0:
-        return False
+    if d3.size < 2:
+        if d3.size==0:
+            return False
+        return d3
     if d3.all():
         return d1[d4].all() 
     else:




More information about the Numpy-svn mailing list