Classification functions¶
xtensor provides the following classification functions for xexpressions and scalars:
Defined in xtensor/xmath.hpp
-
template<class
E>
autoxt::isfinite(E &&e) finite value check
Returns an xfunction for the element-wise finite value check tangent of e.
- Return
an xfunction
- Parameters
e: an xexpression
-
template<class
E>
autoxt::isinf(E &&e) infinity check
Returns an xfunction for the element-wise infinity check tangent of e.
- Return
an xfunction
- Parameters
e: an xexpression
-
template<class
E>
autoxt::isnan(E &&e) NaN check.
Returns an xfunction for the element-wise NaN check tangent of e.
- Return
an xfunction
- Parameters
e: an xexpression
-
template<class
E1, classE2>
autoxt::isclose(E1 &&e1, E2 &&e2, double rtol = 1e-05, double atol = 1e-08, bool equal_nan = false)¶ Element-wise closeness detection.
Returns an xfunction that evaluates to true if the elements in
e1ande2are close to each other according to parametersatolandrtol. The equation is:std::abs(a - b) <= (m_atol + m_rtol * std::abs(b)).- Return
an xfunction
- Parameters
e1: input array to comparee2: input array to comparertol: the relative tolerance parameter (default 1e-05)atol: the absolute tolerance parameter (default 1e-08)equal_nan: if true, isclose returns true if both elements of e1 and e2 are NaN
-
template<class
E1, classE2>
autoxt::allclose(E1 &&e1, E2 &&e2, double rtol = 1e-05, double atol = 1e-08)¶ Check if all elements in e1 are close to the corresponding elements in e2.
Returns true if all elements in
e1ande2are close to each other according to parametersatolandrtol.- Return
a boolean
- Parameters
e1: input array to comparee2: input arrays to comparertol: the relative tolerance parameter (default 1e-05)atol: the absolute tolerance parameter (default 1e-08)