...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
boost::compute::inclusive_scan
// In header: <boost/compute/algorithm/inclusive_scan.hpp> template<typename InputIterator, typename OutputIterator, typename BinaryOperator> OutputIterator inclusive_scan(InputIterator first, InputIterator last, OutputIterator result, BinaryOperator binary_op, command_queue & queue = system::default_queue()); template<typename InputIterator, typename OutputIterator> OutputIterator inclusive_scan(InputIterator first, InputIterator last, OutputIterator result, command_queue & queue = system::default_queue());
Performs an inclusive 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 the current value in the input with the sum of every previous value 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).
Space complexity on GPUs: \Omega(n)
Space complexity on GPUs when first
== result:
\Omega(2n)
Space complexity on CPUs: \Omega(1)
See Also:
exclusive_scan()
Parameters: 


Returns: 
