E.V.E  0.1-beta

◆ is_less_equal

eve::is_less_equal = {}
inlineconstexpr

Callable object computing the "less or equal to" predicate.

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

Members Functions

Member Effect
operator() the "less or equal to" predicate
operator[] Construct a conditional version of current function object

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

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

Parameters

cond : conditional expression

Return value

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


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

Parameters

x, y: values.

Return value

Returns the logical value containing the elementwise comparison test result between x and y. The infix notation x <= y can also be used.

The result type is the common compatible type of the two parameters.

Warning
Although the infix notation with <= is supported, the <= operator on standard scalar types is the original one and so returns bool result, not logical.

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

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

Parameters

cond : conditional expression

Return value

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


Supported decorators

no decorators are supported

Example

See it live on Compiler Explorer

#include <eve/function/predicate.hpp>
#include <eve/wide.hpp>
#include <iostream>
int main()
{
wide_ft pf = {0.0f, 1.0f, -1.0f, -2.0f};
wide_ft qf = {1.0f, -1.0f, 0.0f, -2.0f};
std::cout << "---- simd" << '\n'
<< "<- pf = " << pf << '\n'
<< "<- qf = " << qf << '\n'
<< "-> is_less(pf, qf) = " << eve::is_less(pf, qf) << '\n';
float xf = 1.0f;
float yf = 2.0f;
std::cout << "---- scalar" << '\n'
<< "<- xf = " << xf << '\n'
<< "<- yf = " << yf << '\n'
<< "-> is_less(xf, yf) = " << eve::is_less(xf, yf) << '\n';
return 0;
}
constexpr callable_is_less_ is_less
Callable object computing the "less than" predicate.
Definition: is_less.hpp:93
Wrapper for SIMD registers.
Definition: wide.hpp:65