E.V.E  0.1-beta

◆ is_ordered

eve::is_ordered = {}
inlineconstexpr

Callable object computing the is_ordered logical value.

Required header: #include <eve/function/is_ordered.hpp>

Members Functions

Member Effect
operator() the computation of the is_ordered logical value
operator[] Construct a conditional version of current function object

template< value T, value U > auto operator()( T x, U y ) const noexcept requires compatible< T, U >;

Parameters

x, y: values.

Return value

The call:

constexpr callable_is_ordered_ is_ordered
Callable object computing the is_ordered logical value.
Definition: is_ordered.hpp:85
Wrapper for SIMD compatible logical types.
Definition: logical.hpp:36

is semantically equivalent to:

if constexpr(floating_real_value<T>) r = is_not_nan(x) && is_not_nan(y);
else constexpr(integral_real_value<T>) r = true_<T>();
Definition: value.hpp:103
Definition: value.hpp:113
constexpr callable_is_not_nan_ is_not_nan
Callable object computing the is_not_nan logical value.
Definition: is_not_nan.hpp:83

auto operator[]( conditional_expression auto cond ) const noexcept;

Higher-order function generating a masked version of eve::is_ordered

Parameters

cond : conditional expression

Return value

A Callable object so that the expression is_ordered[cond](x, y) is equivalent to if_else(cond,is_ordered(x, y),false(as(is_ordered(x, y))))


Supported decorators

no decorators are supported

Example

See it live on Compiler Explorer

#include <eve/function/is_ordered.hpp>
#include <eve/wide.hpp>
#include <eve/constant/inf.hpp>
#include <eve/constant/minf.hpp>
#include <eve/constant/nan.hpp>
#include <iostream>
int main()
{
wide_ft pf = {0.0f, 1.0f, -1.0f, -2.0f, 2.0f,
wide_ft qf = {4.0f, 1.0f, -1.0f, 0.0f, -0.0f,
std::cout << "---- simd" << '\n'
<< "<- pf = " << pf << '\n'
<< "<- qf = " << qf << '\n'
<< "-> is_ordered(pf, qf) = " << eve::is_ordered(pf, qf) << '\n';
float xf = 4.0f;
float yf = -1.0f;
std::cout << "---- scalar" << '\n'
<< "<- xf = " << xf << '\n'
<< "<- yf = " << yf << '\n'
<< "-> is_ordered(xf, yf) = " << eve::is_ordered(xf, yf) << '\n';
return 0;
}
constexpr callable_nan_ nan
Callable object computing the nan value.
Definition: nan.hpp:52
constexpr callable_minf_ minf
Callable object computing the negative infinity value.
Definition: minf.hpp:55
constexpr callable_inf_ inf
Callable object computing the infinity ieee value.
Definition: inf.hpp:54
Lightweight type-wrapper.
Definition: as.hpp:29
Wrapper for SIMD registers.
Definition: wide.hpp:65