| Home | Libraries | People | FAQ | More

## Function 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());
    template<typename InputIterator, typename OutputIterator>
      OutputIterator
      adjacent_difference(InputIterator first, InputIterator last,
                          OutputIterator result,
                          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.

See Also:

adjacent_find()

Parameters:

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

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