E.V.E
v2023.02.15
 
Loading...
Searching...
No Matches

◆ count_true

callable_count_true_ eve::count_true = {}
inlineconstexpr

Header file

#include <eve/module/core.hpp>

Callable Signatures

namespace eve
{
// Regular overloads
constexpr auto count_true(logical_value auto x) noexcept; // 1
constexpr auto count_true(top_bits auto t) noexcept; // 1
// Lanes masking
constexpr auto count_true[conditional_expr auto c](/* any of the above overloads */) noexcept; // 2
constexpr auto count_true[logical_value auto m](/* any of the above overloads */) noexcept; // 2
}
Specifies that a type is a Conditional Expression.
Definition conditional.hpp:28
The concept logical_value<T> is satisfied if and only if T satisfies eve::value and the element type ...
Definition value.hpp:132
constexpr callable_count_true_ count_true
Computes the number of non 0 elements.
Definition count_true.hpp:73
EVE Main Namespace.
Definition abi.hpp:18
The cheapest to get bitset for simd logical.
Definition forward.hpp:16

Parameters

Return value

  1. The value in the element type of x of the number of non 0 elements.
  2. A masked version which return the number of true retained elements.

Parameters

Return value

The value of the number of non 0 elements is returned.

Example

// revision 0
#include <eve/module/core.hpp>
#include <iostream>
int main()
{
eve::wide wu0{0u, 1u, 2u, 3u, 4u, 5u, 6u, 7u};
std::cout << "<- wu0 = " << wu0 << "\n";
std::cout << "-> count_true(wu0 <= maximum(wu0)/2) = " << eve::count_true(wu0 <= eve::maximum(wu0)/2) << "\n";
std::cout << "-> count_true[ignore_last(2)](wu0 <= maximum(wu0)/2) = " << eve::count_true[eve::ignore_last(2)](wu0 <= eve::maximum(wu0)/2) << "\n";
}
constexpr callable_maximum_ maximum
Computes the maximal value in a simd vector.
Definition maximum.hpp:55
Conditional expression ignoring the k last lanes from a eve::simd_value.
Definition conditional.hpp:332
Wrapper for SIMD registers.
Definition wide.hpp:70

Semantic Modifiers

  • Masked Call

    The call eve::$name$[mask](x, ...) provides a masked version of `count_true which count the non masked non zero element