E.V.E
v2023.02.15
Loading...
Searching...
No Matches
◆
scan
auto eve::scan =
functor
<scan_t>
inline
constexpr
Header file
#include <eve/module/core.hpp>
Callable Signatures
namespace
eve
{
template
<simd_value W
id
e, eve::abelian_mono
id
<W
id
e> Op, eve::substitute_for<W
id
e> Zero>
constexpr
Wide
scan
(Wide
auto
x, Op op, Zero
zero
)
noexcept
;
// 1
template
<simd_value W
id
e>
constexpr
Wide
scan
(Wide x)
noexcept
;
// 2
}
eve::zero
constexpr auto zero
Computes the constant 0.
Definition
zero.hpp:78
eve::scan
constexpr auto scan
Computes the generalized prefix sum over a simd value.
Definition
scan.hpp:82
eve
EVE Main Namespace.
Definition
abi.hpp:19
Parameters
x
: An instance of an
SIMD value
op
: The commutative and associative binary operation to apply.
zero
: The identity/neutral element used by the operation.
Return value
Returns the generalized prefix sum over
x
using the binary operation
op
and the identity element
zero
.
Equivalent to
eve::scan(x, eve::add, eve::zero)
.
Note
Given a binary operation
op
, a call to
eve::scan
is defined only if
op
is associative, commutative, and pure.
Example
#include <eve/module/core.hpp>
#include <iostream>
int
main()
{
eve::wide
x = {1.0, 2.0, 3.0, 4.0};
std::cout <<
"x: "
<< x <<
"\n"
;
std::cout <<
"eve::scan(x): "
<<
eve::scan
(x) <<
"\n"
;
std::cout <<
"eve::scan(x, eve::mul, eve::one): "
<<
eve::scan
(x,
eve::mul
,
eve::one
) <<
"\n"
;
}
eve::mul
constexpr auto mul
tuple_callable computing the product of its arguments.
Definition
mul.hpp:128
eve::one
constexpr auto one
Computes the constant .
Definition
one.hpp:66
eve::wide
Wrapper for SIMD registers.
Definition
wide.hpp:94
eve