E.V.E
v2023.02.15

◆ binarize_not

eve::binarize_not = {}
inlineconstexpr

transform logical values to numerical values

binarize_not(c, v) is semantically equivalent to: if_else(c, T(0), v);

Defined in Header

#include <eve/module/core.hpp>

Callable Signatures

namespace eve
{
template< eve::value C >
C binarize_not(eve::as_logical<C> c) noexcept; //1
template<eve::value C, eve::value V >
T binarize_not(eve::as_logical<C> c, T v) noexcept; //2
}
constexpr callable_binarize_not_ binarize_not
transform logical values to numerical values
Definition: binarize_not.hpp:65
Definition: abi.hpp:18

Parameters

  • c : condition.
  • v : value to return if the condition is not met (C(1) if omitted).

Return value

  1. The value of if_else(c, T(0), v) is returned.
  2. The value of if_else(c, C(0), C(1)) is returned.

Example

#include <eve/module/core.hpp>
#include <eve/wide.hpp>
#include <iostream>
int main()
{
wide_ft pf = { 0.0f, 1.0f, -1.0f, -0.5f};
std::cout
<< "---- simd" << '\n'
<< "<- pf = " << pf << '\n'
<< "-> binarize_not(pf > 0.0f) = " << eve::binarize_not(pf> 0.0f) << '\n'
<< "-> binarize_not(pf > 0.0f, 3) = " << eve::binarize_not(pf> 0.0f, 3) << '\n';
float xf = 1.0f;
std::cout
<< "---- scalar" << '\n'
<< "<- xf = " << xf << '\n'
<< "-> binarize_not(true_(eve::as<float>()), xf) = " << eve::binarize_not(eve::true_(eve::as<float>()), xf) << '\n'
<< "-> binarize_not(false_(eve::as<float>()), xf) = " << eve::binarize_not(eve::false_(eve::as<float>()), xf) << '\n' ;
return 0;
}
constexpr callable_false__ false_
Computes the false logical value.
Definition: false.hpp:52
constexpr callable_true__ true_
Computes the logical true_ value.
Definition: true.hpp:52
Lightweight type-wrapper.
Definition: as.hpp:29
Wrapper for SIMD registers.
Definition: wide.hpp:65