vir-simd 0.4.189
Parallelism TS 2 extensions and simd fallback implementation
Loading...
Searching...
No Matches
Algorithm: transform

Applies the given callable to the elements of the given input range, and stores the result in an output range. More...

Functions

template<detail::simd_execution_policy ExecutionPolicy, detail::simd_execution_iterator It1, detail::simd_execution_iterator OutIt, typename UnaryOperation>
constexpr OutIt vir::transform (ExecutionPolicy pol, It1 first1, It1 last1, OutIt d_first, UnaryOperation unary_op)
 Unary transform (iterator overload)
 
template<detail::simd_execution_policy ExecutionPolicy, detail::simd_execution_iterator It1, detail::simd_execution_iterator It2, detail::simd_execution_iterator OutIt, typename BinaryOperation>
constexpr OutIt vir::transform (ExecutionPolicy pol, It1 first1, It1 last1, It2 first2, OutIt d_first, BinaryOperation binary_op)
 Binary transform (iterator overload)
 
template<detail::simd_execution_policy ExecutionPolicy, detail::simd_execution_range R1, detail::simd_execution_range R2, typename UnaryOperation>
constexpr auto vir::transform (ExecutionPolicy pol, R1 &&r1, R2 &d_rng, UnaryOperation unary_op)
 Unary transform (range overload)
 
template<detail::simd_execution_policy ExecutionPolicy, detail::simd_execution_range R1, detail::simd_execution_range R2, detail::simd_execution_range R3, typename BinaryOperation>
constexpr auto vir::transform (ExecutionPolicy pol, R1 &&r1, R2 &&r2, R3 &d_rng, BinaryOperation binary_op)
 Binary transform (range overload)
 
template<detail::simd_execution_range... Rs>
constexpr auto vir::transform (detail::simd_execution_policy auto pol, const std::ranges::zip_view< Rs... > &rs, detail::simd_execution_range auto &&d_rg, auto op)
 Many-input transform (zipped range overload)
 
template<vir::detail::simd_execution_policy ExecutionPolicy, vir::detail::simd_execution_iterator It1, vir::detail::simd_execution_iterator OutIt, typename UnaryOperation>
constexpr OutIt std::transform (ExecutionPolicy pol, It1 first1, It1 last1, OutIt d_first, UnaryOperation unary_op)
 Overloads std::transform for vir::execution::simd.
 
template<vir::detail::simd_execution_policy ExecutionPolicy, vir::detail::simd_execution_iterator It1, vir::detail::simd_execution_iterator It2, vir::detail::simd_execution_iterator OutIt, typename BinaryOperation>
constexpr OutIt std::transform (ExecutionPolicy pol, It1 first1, It1 last1, It2 first2, OutIt d_first, BinaryOperation binary_op)
 Overloads std::transform for vir::execution::simd.
 

Detailed Description

Applies the given callable to the elements of the given input range, and stores the result in an output range.

These functions are drop-in replacements for std::transform. The only difference is that unary_op / binary_op are called with multiple values out of the input range via simd arguments. The callable needs to return a simd of the value-type of the output range.

The zip_view overload looks through the zip_view, effectively turning this into a transform with arbitrary number of input ranges.

Returns
Output iterator to the element that follows the last element transformed.
Parameters
polNeeds to be vir::execution::simd or one of the derived types returned from its modifiers. (vir::detail::simd_execution_policy)
first1,last1Iterator pair modelling vir::detail::simd_execution_iterator.
first2Begin iterator modelling vir::detail::simd_execution_iterator. std::distance (first1, last1) determines the size of this range.
r1,r2Input ranges modelling vir::detail::simd_execution_range.
rsInput range where each input to std::ranges::views::zip (Rs...) models vir::detail::simd_execution_range.
d_firstOutput iterator modelling vir::detail::simd_execution_iterator.
d_rngOutput range modelling vir::detail::simd_execution_range.
unary_op,binary_opCallable to be invoked per chunk of input elements.