diff options
author | Travis Oliphant <oliphant@enthought.com> | 2007-05-17 11:55:11 +0000 |
---|---|---|
committer | Travis Oliphant <oliphant@enthought.com> | 2007-05-17 11:55:11 +0000 |
commit | 4eb3bf56a0d3de3fb67fe6d3fcbd55e798ea4fca (patch) | |
tree | c4d260d99374417593a3d39e26fd456b580d48d4 /numpy/core/numeric.py | |
parent | 50894958e9a8f515ed85c27127cd91a784eb8308 (diff) | |
download | numpy-4eb3bf56a0d3de3fb67fe6d3fcbd55e798ea4fca.tar.gz |
Fix ticekt #511 and start to handle allclose problems.
Diffstat (limited to 'numpy/core/numeric.py')
-rw-r--r-- | numpy/core/numeric.py | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/numpy/core/numeric.py b/numpy/core/numeric.py index b628a858d..0a616582a 100644 --- a/numpy/core/numeric.py +++ b/numpy/core/numeric.py @@ -838,13 +838,17 @@ def allclose(a, b, rtol=1.e-5, atol=1.e-8): d1 = less_equal(absolute(x-y), atol + rtol * absolute(y)) xinf = isinf(x) yinf = isinf(y) - xneg = signbit(x) - yneg = signbit(y) - d2 = (xinf == yinf) - d3 = (xneg == yneg) - d4 = logical_not(d2) - return (d1.all() and not d4.any()) or (d2.all() and d3.all()) - + 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.all(): + return d1[d4].all() + else: + return False def array_equal(a1, a2): try: |