E.V.E
v2022.09.01

◆ any

eve::any = {}
inlineconstexpr

Computes a bool value which is true if and only if any elements of x is not zero.

Defined in Header

#include <eve/module/core.hpp>

Callable Signatures

namespace eve
{
template< eve::value T >
bool any(eve::as_logical<T> x) noexcept; //1
template< eve::top_bits M >
bool any(M m) noexcept; //2
}
constexpr callable_any_ any
Computes a bool value which is true if and only if any elements of x is not zero.
Definition: any.hpp:71
Definition: all_of.hpp:22
  • 1. A bool value which is true if and only if any element of x is not zero.
  • 2 A bool value which is true if and only if any top bits element of x is not zero.

Parameters

Return value

A bool value which is true if and only if any elements of x is not zero is returned.

Example

#include <eve/wide.hpp>
#include <iostream>
int main()
{
wide_ft pf = { 0.0f, 0.0f, -0.0f, -0.0f};
wide_it qi = {-1.0f, 02.0f, -3.0f, -0.0f};
std::cout << "---- simd" << '\n'
<< "<- pf = " << pf << '\n'
<< "-> any(pf != 0) = " << eve::any(pf != 0) << '\n'
<< "<- qi = " << qi << '\n'
<< "-> any(qi != 0) = " << eve::any(qi != 0) << '\n';
float xf = -0.0f;
float yf = -3.0f;
std::cout << "---- scalar" << '\n'
<< "<- xf = " << xf << '\n'
<< "-> any(xf != 0) = " << eve::any(xf != 0) << '\n'
<< "<- yf = " << yf << '\n'
<< "-> any(yf != 0) = " << eve::any(yf != 0) << '\n';
return 0;
}
Wrapper for SIMD registers.
Definition: wide.hpp:65

Semantic Modifiers

  • Masked Call

    The call eve::any[mask](x) provides a masked version of any which is equivalent to : any not masked elements is not zero.

    Example

    #include <eve/module/core.hpp>
    #include <eve/wide.hpp>
    #include <iostream>
    int main()
    {
    wide_ft pf = {1.0f, 0.0f, 0.0f, 0.0f};
    std::cout << "---- simd" << '\n'
    << "<- pf = " << pf << '\n'
    << "-> any[ignore_first(1)](pf > 0.5f) = " << eve::any[eve::ignore_first(1)](pf > 0.5f) << '\n';
    return 0;
    }
    Conditional expression ignoring the k first lanes from a eve::simd_value.
    Definition: conditional.hpp:419