Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for a snapshot of the develop branch, built from commit 3785d1f795.
PrevUpHomeNext

Function template transform_reduce

boost::compute::transform_reduce

Synopsis

// In header: <boost/compute/algorithm/transform_reduce.hpp>


template<typename InputIterator, typename OutputIterator, 
         typename UnaryTransformFunction, typename BinaryReduceFunction> 
  void transform_reduce(InputIterator first, InputIterator last, 
                        OutputIterator result, 
                        UnaryTransformFunction transform_function, 
                        BinaryReduceFunction reduce_function, 
                        command_queue & queue = system::default_queue());

Description

Transforms each value in the range [first, last) with the unary transform_function and then reduces each transformed value with reduce_function.

For example, to calculate the sum of the absolute values of a vector of integers:


Space complexity on GPUs: \Omega(n)
Space complexity on CPUs: \Omega(1)

See Also:

reduce(), inner_product()


PrevUpHomeNext