From 51a096bcbc86d372c3568e721acc11c3c8e92676 Mon Sep 17 00:00:00 2001 From: Chris Jordan-Squire Date: Mon, 1 Aug 2011 10:58:35 -0500 Subject: ENH: Faster asarray_chkfinite --- numpy/lib/function_base.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/numpy/lib/function_base.py b/numpy/lib/function_base.py index 8a0c0b37d..caef5c709 100644 --- a/numpy/lib/function_base.py +++ b/numpy/lib/function_base.py @@ -585,8 +585,7 @@ def asarray_chkfinite(a, dtype=None, order=None): """ a = asarray(a, dtype=dtype, order=order) - if (a.dtype.char in typecodes['AllFloat']) \ - and (_nx.isnan(a).any() or _nx.isinf(a).any()): + if a.dtype.char in typecodes['AllFloat'] and not np.isfinite(a).all(): raise ValueError( "array must not contain infs or NaNs") return a -- cgit v1.2.3