◆ binarize
Callable object computing the binarize operation. Required header: Members Functions
template< value T, scalar_value V > T operator()( Logical< T > c, V v = 1 ) const noexcept;
Parameters
Return value The call: logical<T> r = binarize(c,v);
constexpr callable_binarize_ binarize Callable object computing the binarize operation. Definition: binarize.hpp:83 is semantically equivalent to: T r = if_else(c, T(v), T(0));
constexpr callable_if_else_ if_else Callable object computing the if_else operation. Definition: if_else.hpp:99 auto operator[]( conditional_expression auto cond ) const noexcept;
Higher-order function generating a masked version of eve::binarize Parameters
Return value A Callable object so that the expression Supported decoratorsno decorators are supported ExampleSee it live on Compiler Explorer #include <eve/function/binarize.hpp>
#include <eve/constant/false.hpp>
#include <eve/constant/true.hpp>
#include <eve/wide.hpp>
#include <iostream>
using wide_ft = eve::wide <float, eve::fixed<4>>;
int main()
{
wide_ft pf = { 0.0f, 1.0f, -1.0f, -0.5f};
std::cout
<< "---- simd" << '\n'
<< "<- pf = " << pf << '\n'
float xf = -1.0f;
std::cout
<< "---- scalar" << '\n'
<< "<- xf = " << xf << '\n'
<< "-> binarize(true_(eve::as<float>()), xf) = " << eve::binarize(eve::true_(eve::as<float>()), xf) << '\n'
<< "-> binarize(false_(eve::as<float>()), xf) = " << eve::binarize(eve::false_(eve::as<float>()), xf) << '\n' ;
return 0;
}
constexpr callable_false__ false_ Callable object computing the logical false_ value. Definition: false.hpp:52 constexpr callable_true__ true_ Callable object computing the logical true_ value. Definition: true.hpp:52 |