| Home | Libraries | People | FAQ | More

## Function template adjacent_difference

boost::compute::adjacent_difference

## Synopsis

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

    template<typename InputIterator, typename OutputIterator,
             typename BinaryFunction>
      OutputIterator
      adjacent_difference(InputIterator first, InputIterator last,
                          OutputIterator result, BinaryFunction op,
                          command_queue & queue = system::default_queue());

## Description

Stores the difference of each pair of consecutive values in the range [`first`, `last`) to the range beginning at `result`. If `op` is not provided, `minus<T>` is used.

Space complexity: \Omega(1)
Space complexity when `result` == `first:` \Omega(n)

See Also: adjacent_find()

Parameters:

`first` | first element in the input range
`last` | last element in the input range
`result` | first element in the output range
`op` | binary difference function
`queue` | command queue to perform the operation

Returns: | `OutputIterator` to the end of the result range