|
vir-simd 0.4.189
Parallelism TS 2 extensions and simd fallback implementation
|
Applies transform_op to corresponding input elements and reduces the results along with the initial value init over reduce_op.
More...
Functions | |
| template<detail::simd_execution_policy ExecutionPolicy, detail::simd_execution_iterator It1, detail::simd_execution_iterator It2, typename T> | |
| constexpr T | vir::transform_reduce (ExecutionPolicy policy, It1 first1, It1 last1, It2 first2, T init) |
| Inner product (iterator overload) | |
| template<detail::simd_execution_policy ExecutionPolicy, detail::simd_execution_iterator It1, detail::simd_execution_iterator It2, typename T, typename BinaryReductionOp, typename BinaryTransformOp> | |
| constexpr T | vir::transform_reduce (ExecutionPolicy policy, It1 first1, It1 last1, It2 first2, T init, BinaryReductionOp reduce_op, BinaryTransformOp transform_op) |
| As above but with user-provided transform and reduce operations (iterator overload) | |
| template<detail::simd_execution_policy ExecutionPolicy, detail::simd_execution_iterator It, typename T, typename BinaryReductionOp, typename UnaryTransformOp> | |
| constexpr T | vir::transform_reduce (ExecutionPolicy policy, It first1, It last1, T init, BinaryReductionOp reduce_op, UnaryTransformOp transform_op) |
| Transform one input range with subsequent reduction (iterator overload) | |
| template<detail::simd_execution_policy ExecutionPolicy, detail::simd_execution_range Rng1, detail::simd_execution_range Rng2, typename T> | |
| constexpr T | vir::transform_reduce (ExecutionPolicy policy, Rng1 &&r1, Rng2 &&r2, T init) |
| Inner product (range overload) | |
| template<detail::simd_execution_policy ExecutionPolicy, detail::simd_execution_range Rng1, detail::simd_execution_range Rng2, typename T, typename BinaryReductionOp, typename BinaryTransformOp> | |
| constexpr T | vir::transform_reduce (ExecutionPolicy policy, Rng1 &&r1, Rng2 &&r2, T init, BinaryReductionOp reduce_op, BinaryTransformOp transform_op) |
| As above but with user-provided transform and reduce operations (range overload) | |
| template<detail::simd_execution_policy ExecutionPolicy, detail::simd_execution_range Rng, typename T, typename BinaryReductionOp, typename UnaryTransformOp> | |
| constexpr T | vir::transform_reduce (ExecutionPolicy policy, Rng &&r1, T init, BinaryReductionOp reduce_op, UnaryTransformOp transform_op) |
| Transform one input range with subsequent reduction (range overload) | |
| template<vir::detail::simd_execution_policy ExecutionPolicy, vir::detail::simd_execution_iterator It1, vir::detail::simd_execution_iterator It2, typename T> | |
| constexpr T | std::transform_reduce (ExecutionPolicy policy, It1 first1, It1 last1, It2 first2, T init) |
| Overloads std::transform_reduce for vir::execution::simd. | |
| template<vir::detail::simd_execution_policy ExecutionPolicy, vir::detail::simd_execution_iterator It1, vir::detail::simd_execution_iterator It2, typename T, typename BinaryReductionOp, typename BinaryTransformOp> | |
| constexpr T | std::transform_reduce (ExecutionPolicy policy, It1 first1, It1 last1, It2 first2, T init, BinaryReductionOp reduce_op, BinaryTransformOp transform_op) |
| Overloads std::transform_reduce for vir::execution::simd. | |
| template<vir::detail::simd_execution_policy ExecutionPolicy, vir::detail::simd_execution_iterator It, typename T, typename BinaryReductionOp, typename UnaryTransformOp> | |
| constexpr T | std::transform_reduce (ExecutionPolicy policy, It first1, It last1, T init, BinaryReductionOp reduce_op, UnaryTransformOp transform_op) |
| Overloads std::transform_reduce for vir::execution::simd. | |
Applies transform_op to corresponding input elements and reduces the results along with the initial value init over reduce_op.
These functions are drop-in replacements for std::transform_reduce. The only difference is that reduce_op and transform_op are called with simd<U, Abi> arguments instead of U (where U is the value-type of the corresponding input range).
reduce_op is given, std::plus is used.transform_op is given, std::multiplies is used.| policy | Needs to be vir::execution::simd or one of the derived types returned from its modifiers. (vir::detail::simd_execution_policy) |
| first1,last1 | Iterator pair modelling vir::detail::simd_execution_iterator. |
| first2 | Begin iterator modelling vir::detail::simd_execution_iterator. std::distance (first1, last1) determines the size of this range. |
| r1,r2 | Input ranges modelling vir::detail::simd_execution_range. |
| init | The initial value determines the aggregation type and its value is included in the reduction. |
| reduce_op | A binary operation that will be applied in unspecified order to the results of transform_op, the results of other reduce_op and init. |
| transform_op | A unary or binary operation that will be applied to each element of the input range(s). The return type must be acceptable as input to reduce. |
A possible output (with suitably defined operator<< overloads) of the above example could be:
Note that the final call to reduce adds the init value.