Classification functions

xtensor provides the following classification functions for xexpressions and scalars:

Defined in xtensor/xmath.hpp

template <class E>
auto xt::isfinite(E &&e)

finite value check

Returns an xfunction for the element-wise finite value check tangent of e.

Return
an xfunction
Parameters

template <class E>
auto xt::isinf(E &&e)

infinity check

Returns an xfunction for the element-wise infinity check tangent of e.

Return
an xfunction
Parameters

template <class E>
auto xt::isnan(E &&e)

NaN check.

Returns an xfunction for the element-wise NaN check tangent of e.

Return
an xfunction
Parameters

template <class E1, class E2>
auto xt::isclose(E1 &&a, E2 &&b, 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 element in e1 and e2 are close to each other according to parameters atol and rtol. The equation is: std::abs(a - b) <= (m_atol + m_rtol * std::abs(b)).

Parameters
  • e1

template <class E1, class E2>
auto xt::allclose(E1 &&a, E2 &&b, double rtol = 1e-05, double atol = 1e-08)

Check if all elements in a are close to the corresponding elements in b.

Returns an xfunction that evaluates to true if all elements in e1 and e2 are close to each other according to parameters atol and rtol.

Parameters
  • e1