E.V.E
v2023.02.15
Loading...
Searching...
No Matches
◆
count_true
auto eve::count_true =
functor
<count_true_t>
inline
constexpr
Header file
#include <eve/module/core.hpp>
Callable Signatures
namespace
eve
{
// Regular overloads
template
<relaxed_logical_value L>
std::ptrdiff_t
count_true
(L x)
noexcept
;
// 1
template
<relaxed_logical_value L>
std::ptrdiff_t
count_true
(
top_bits<L>
t)
noexcept
;
// 1
// Lanes masking
std::ptrdiff_t
count_true
[
conditional_expr
auto
c](
/* any of the above overloads */
)
noexcept
;
// 2
std::ptrdiff_t
count_true
[
logical_value
auto
m](
/* any of the above overloads */
)
noexcept
;
// 2
}
eve::conditional_expr
Specifies that a type is a Conditional Expression.
Definition
conditional.hpp:28
eve::logical_value
The concept logical_value<T> is satisfied if and only if T satisfies eve::value and the element type ...
Definition
value.hpp:134
eve::count_true
constexpr auto count_true
Computes the number of elements of the input which evaluates to true.
Definition
count_true.hpp:83
eve
EVE Main Namespace.
Definition
abi.hpp:19
eve::top_bits
The cheapest to get bitset for simd logical.
Definition
top_bits.hpp:80
Parameters
x
:
argument
.
t
:
top bits
.
c
:
Conditional expression
masking the operation.
m
:
Logical value
masking the operation.
Return value
The number of elements in
x
which evaluates to
true
. Scalar values are treated as one element.
The masked version which return the number of non-masked true elements.
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"
;
}
eve::maximum
constexpr auto maximum
Computes the maximal value in a simd vector or valmin if the input is fully masked.
Definition
maximum.hpp:83
eve::ignore_last
Conditional expression ignoring the k last lanes from a eve::simd_value.
Definition
conditional.hpp:353
eve::wide
Wrapper for SIMD registers.
Definition
wide.hpp:94
Semantic Modifiers
eve