|
inlineconstexpr |
#include <eve/module/algo/algo/reduce.hpp>
Configurable Callable Object performing a SIMD optimized version of the reduce By default, the operation will be unrolled by a factor of 4, align memory accesses and perform conversions if needed.
Due to the nature of how SIMD algorithms work, the reduce operation has to be paired with its, neutral element. For example, for add you pass {add, zero}
as zero is the identity for add. Instead of zero it can be beneficial to pass eve's constants like eve::zero
, eve::one
because sometimes the implementation can be improved
Alternative Header
rng
along with the initial value init
using regular addition.rng
along with the initial value init
over op_zero
.Parameters
rng
: Relaxed range input range to processinit
: Initial value. Also type of init matches the result typeop_zero
: Pair of reduction operation (commutative/associative) and an identity (zero) for it. Default add_zero is {eve::add, eve::zero}
.Return value
init
and every elements of rng
.init
and every elements of rng
using op_zero
.