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

◆ scan

auto eve::scan = functor<scan_t>
inlineconstexpr

Header file

#include <eve/module/core.hpp>

Callable Signatures

namespace eve
{
template<simd_value Wide, eve::monoid<Wide> Op, eve::substitute_for<Wide> Zero>
constexpr Wide scan(Wide auto x, Op op, Zero zero) noexcept; // 1
template<simd_value Wide>
constexpr Wide scan(Wide x) noexcept; // 2
}
constexpr auto zero
Computes the constant 0.
Definition zero.hpp:78
constexpr auto scan
Computes the generalized prefix sum over a simd value.
Definition scan.hpp:79
EVE Main Namespace.
Definition abi.hpp:18

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

  1. Returns the generalized prefix sum over x using the binary operation op and the identity element zero.
  2. 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";
}
constexpr auto mul
tuple_callablecomputing the product of its arguments. ! ! @groupheader{Header file}...
Definition mul.hpp:119
constexpr auto one
Computes the constant .
Definition one.hpp:65
Wrapper for SIMD registers.
Definition wide.hpp:93