We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents af34c3c + d8a42ff commit 885525dCopy full SHA for 885525d
numexpr/expressions.py
@@ -368,6 +368,7 @@ def multiply(x, y):
368
369
'isnan': func(numpy.isnan, 'bool'),
370
'isfinite': func(numpy.isfinite, 'bool'),
371
+ 'isinf': func(numpy.isinf, 'bool'),
372
373
'sum': gen_reduce_axis_func('sum'),
374
'prod': gen_reduce_axis_func('prod'),
@@ -524,6 +525,6 @@ class FuncNode(OpNode):
524
525
def __init__(self, opcode=None, args=None, kind=None):
526
if (kind is None) and (args is not None):
527
kind = commonKind(args)
- if opcode in ("isnan", "isfinite"): # bodge for boolean return functions
528
+ if opcode in ("isnan", "isfinite", "isinf"): # bodge for boolean return functions
529
kind = 'bool'
530
OpNode.__init__(self, opcode, args, kind)
numexpr/functions.hpp
@@ -93,6 +93,7 @@ FUNC_DD(FUNC_DD_LAST, NULL, NULL, NULL)
93
#endif
94
FUNC_BD(FUNC_ISNAN_BD, "isnan_bd", isnand, vdIsnan)
95
FUNC_BD(FUNC_ISFINITE_BD, "isfinite_bd", isfinited, vdIsfinite)
96
+FUNC_BD(FUNC_ISINF_BD, "isinf_bd", isinfd, vdIsinf)
97
FUNC_BD(FUNC_BD_LAST, NULL, NULL, NULL)
98
#ifdef ELIDE_FUNC_BD
99
#undef ELIDE_FUNC_BD
@@ -106,6 +107,7 @@ FUNC_BD(FUNC_BD_LAST, NULL, NULL, NULL)
106
107
#endif // use wrappers as there is name collision with isnanf in std
108
FUNC_BF(FUNC_ISNAN_BF, "isnan_bf", isnanf_, isnanf2, vfIsnan)
109
FUNC_BF(FUNC_ISFINITE_BF, "isfinite_bf", isfinitef_, isfinitef2, vfIsfinite)
110
+FUNC_BF(FUNC_ISINF_BF, "isinf_bf", isinff_, isinff2, vfIsinf)
111
FUNC_BF(FUNC_BF_LAST, NULL, NULL, NULL, NULL)
112
#ifdef ELIDE_FUNC_BF
113
#undef ELIDE_FUNC_BF
numexpr/msvc_function_stubs.hpp
@@ -54,7 +54,8 @@ inline bool isfinitef_(float x) { return !!::_finite(x); } // MSVC has _finite
54
inline bool isnanf_(float x) { return !!::_isnan(x); } // MSVC has _isnan
55
inline bool isfinited(double x) { return !!::_finite(x); }
56
inline bool isnand(double x) { return !!::_isnan(x); }
57
-
+inline bool isinfd(double x) { return !!::isinf(x); }
58
+inline bool isinff_(float x) { return !!::isinf(x); }
59
60
/* Now the actual stubs */
61
@@ -151,6 +152,11 @@ inline bool isfinitef2(float x) {
151
152
return isfinitef_(x);
153
}
154
155
+inline bool isinff2(float x) {
156
+ return isinff_(x);
157
+}
158
+
159
160
// Needed for allowing the internal casting in numexpr machinery for
161
// conjugate operations
162
inline float fconjf2(float x) {
numexpr/necompiler.py
@@ -71,7 +71,8 @@
71
"ceil",
72
"floor",
73
"isnan",
74
- "isfinite"
+ "isfinite",
75
+ "isinf",
76
]
77
78
numexpr/numexpr_config.hpp
@@ -55,6 +55,8 @@ inline bool isfinitef_(float x) { return !!::isfinite(x); }
inline bool isnanf_(float x) { return !!::isnan(x); }
inline bool isfinited(double x) { return !!::isfinite(x); }
inline bool isnand(double x) { return !!::isnan(x); }
62
#endif // NUMEXPR_CONFIG_HPP
numexpr/tests/test_numexpr.py
@@ -703,10 +703,12 @@ def test_bool_funcs(self):
703
704
assert np.all(evaluate("isnan(a)") == np.isnan(a))
705
assert np.all(evaluate("isfinite(a)") == np.isfinite(a))
706
+ assert np.all(evaluate("isinf(a)") == np.isinf(a))
707
a = a.astype(np.float64)
708
assert a.dtype == np.float64
709
710
711
712
713
if 'sparc' not in platform.machine():
714
# Execution order set here so as to not use too many threads
0 commit comments