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 an old version of Boost. Click here to view this page for the latest version.
PrevUpHomeNext

Function exclusive_scan

boost::compute::exclusive_scan

Synopsis

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


template<typename InputIterator, typename OutputIterator, typename T, 
         typename BinaryOperator> 
  OutputIterator 
  exclusive_scan(InputIterator first, InputIterator last, 
                 OutputIterator result, T init, BinaryOperator binary_op, 
                 command_queue & queue = system::default_queue());
template<typename InputIterator, typename OutputIterator, typename T> 
  OutputIterator 
  exclusive_scan(InputIterator first, InputIterator last, 
                 OutputIterator result, T init, 
                 command_queue & queue = system::default_queue());
template<typename InputIterator, typename OutputIterator> 
  OutputIterator 
  exclusive_scan(InputIterator first, InputIterator last, 
                 OutputIterator result, 
                 command_queue & queue = system::default_queue());

Description

Performs an exclusive scan of the elements in the range [first, last) and stores the results in the range beginning at result.

Each element in the output is assigned to the sum of all the previous values in the input.

The default operation is to add the elements up.


But different associative operation can be specified as binary_op instead (e.g., multiplication, maximum, minimum). Also value used to initialized the scan sequence can be specified.


Space complexity on GPUs: (n)
Space complexity on GPUs when first == result: (2n)
Space complexity on CPUs: (1)

See Also:

inclusive_scan()

Parameters:

binary_op

associative binary operator

first

first element in the range to scan

init

value used to initialize the scan sequence

last

last element in the range to scan

queue

command queue to perform the operation

result

first element in the result range

Returns:

OutputIterator to the end of the result range


PrevUpHomeNext