Reduction operatorsΒΆ

reduce()

generic batch reduction

reduce_add()

sum of each batch element

reduce_max()

max of the batch elements

reduce_min()

min of the batch elements

haddp()

horizontal sum across batches


template <class T, class A>
XSIMD_INLINE batch<T, A> xsimd::haddp(batch< T, A > const * row)

Parallel horizontal addition: adds the scalars of each batch in the array pointed by row and store them in a returned batch.

Return

the result of the reduction.

Parameters
  • row: an array of N batches

template <class T, class A, class F>
XSIMD_INLINE T xsimd::reduce(F && f, batch< T, A > const & x)

Generic reducer using only batch operations.

Return

the result of the reduction, as a scalar.

Parameters
  • f: reducing function, accepting batch ()(batch, batch)

  • x: batch involved in the reduction

template <class T, class A>
XSIMD_INLINE T xsimd::reduce_add(batch< T, A > const & x)

Adds all the scalars of the batch x.

Return

the result of the reduction.

Parameters
  • x: batch involved in the reduction

template <class T, class A>
XSIMD_INLINE T xsimd::reduce_max(batch< T, A > const & x)

Max of all the scalars of the batch x.

Return

the result of the reduction.

Parameters
  • x: batch involved in the reduction

template <class T, class A>
XSIMD_INLINE T xsimd::reduce_min(batch< T, A > const & x)

Min of all the scalars of the batch x.

Return

the result of the reduction.

Parameters
  • x: batch involved in the reduction