libstdc++
Generalized Numeric operations
Collaboration diagram for Generalized Numeric operations:

Functions

template<typename _InputIterator , typename _Tp >
constexpr _Tp std::accumulate (_InputIterator __first, _InputIterator __last, _Tp __init)
 
template<typename _InputIterator , typename _Tp , typename _BinaryOperation >
constexpr _Tp std::accumulate (_InputIterator __first, _InputIterator __last, _Tp __init, _BinaryOperation __binary_op)
 
template<typename _InputIterator , typename _OutputIterator >
constexpr _OutputIterator std::adjacent_difference (_InputIterator __first, _InputIterator __last, _OutputIterator __result)
 
template<typename _InputIterator , typename _OutputIterator , typename _BinaryOperation >
constexpr _OutputIterator std::adjacent_difference (_InputIterator __first, _InputIterator __last, _OutputIterator __result, _BinaryOperation __binary_op)
 
template<typename _InputIterator1 , typename _InputIterator2 , typename _Tp >
constexpr _Tp std::inner_product (_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _Tp __init)
 
template<typename _InputIterator1 , typename _InputIterator2 , typename _Tp , typename _BinaryOperation1 , typename _BinaryOperation2 >
constexpr _Tp std::inner_product (_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _Tp __init, _BinaryOperation1 __binary_op1, _BinaryOperation2 __binary_op2)
 
template<typename _ForwardIterator , typename _Tp >
constexpr void std::iota (_ForwardIterator __first, _ForwardIterator __last, _Tp __value)
 
template<typename _InputIterator , typename _OutputIterator >
constexpr _OutputIterator std::partial_sum (_InputIterator __first, _InputIterator __last, _OutputIterator __result)
 
template<typename _InputIterator , typename _OutputIterator , typename _BinaryOperation >
constexpr _OutputIterator std::partial_sum (_InputIterator __first, _InputIterator __last, _OutputIterator __result, _BinaryOperation __binary_op)
 

Detailed Description

Function Documentation

◆ accumulate() [1/2]

template<typename _InputIterator , typename _Tp >
constexpr _Tp std::accumulate ( _InputIterator  __first,
_InputIterator  __last,
_Tp  __init 
)
inlineconstexpr

Accumulate values in a range.

Accumulates the values in the range [first,last) using operator+(). The initial value is init. The values are processed in order.

Parameters
__firstStart of range.
__lastEnd of range.
__initStarting value to add other values to.
Returns
The final sum.

Definition at line 134 of file stl_numeric.h.

Referenced by __gnu_parallel::__parallel_partial_sum_linear().

◆ accumulate() [2/2]

template<typename _InputIterator , typename _Tp , typename _BinaryOperation >
constexpr _Tp std::accumulate ( _InputIterator  __first,
_InputIterator  __last,
_Tp  __init,
_BinaryOperation  __binary_op 
)
inlineconstexpr

Accumulate values in a range with operation.

Accumulates the values in the range [first,last) using the function object __binary_op. The initial value is __init. The values are processed in order.

Parameters
__firstStart of range.
__lastEnd of range.
__initStarting value to add other values to.
__binary_opFunction object to accumulate with.
Returns
The final sum.

Definition at line 161 of file stl_numeric.h.

◆ adjacent_difference() [1/2]

template<typename _InputIterator , typename _OutputIterator >
constexpr _OutputIterator std::adjacent_difference ( _InputIterator  __first,
_InputIterator  __last,
_OutputIterator  __result 
)
constexpr

Return differences between adjacent values.

Computes the difference between adjacent values in the range [first,last) using operator-() and writes the result to __result.

Parameters
__firstStart of input range.
__lastEnd of input range.
__resultOutput sums.
Returns
Iterator pointing just beyond the values written to result.

_GLIBCXX_RESOLVE_LIB_DEFECTS DR 539. partial_sum and adjacent_difference should mention requirements

Definition at line 338 of file stl_numeric.h.

◆ adjacent_difference() [2/2]

template<typename _InputIterator , typename _OutputIterator , typename _BinaryOperation >
constexpr _OutputIterator std::adjacent_difference ( _InputIterator  __first,
_InputIterator  __last,
_OutputIterator  __result,
_BinaryOperation  __binary_op 
)
constexpr

Return differences between adjacent values.

Computes the difference between adjacent values in the range [__first,__last) using the function object __binary_op and writes the result to __result.

Parameters
__firstStart of input range.
__lastEnd of input range.
__resultOutput sum.
__binary_opFunction object.
Returns
Iterator pointing just beyond the values written to result.

_GLIBCXX_RESOLVE_LIB_DEFECTS DR 539. partial_sum and adjacent_difference should mention requirements

Definition at line 382 of file stl_numeric.h.

◆ inner_product() [1/2]

template<typename _InputIterator1 , typename _InputIterator2 , typename _Tp >
constexpr _Tp std::inner_product ( _InputIterator1  __first1,
_InputIterator1  __last1,
_InputIterator2  __first2,
_Tp  __init 
)
inlineconstexpr

Compute inner product of two ranges.

Starting with an initial value of __init, multiplies successive elements from the two ranges and adds each product into the accumulated value using operator+(). The values in the ranges are processed in order.

Parameters
__first1Start of range 1.
__last1End of range 1.
__first2Start of range 2.
__initStarting value to add other values to.
Returns
The final inner product.

Definition at line 190 of file stl_numeric.h.

◆ inner_product() [2/2]

template<typename _InputIterator1 , typename _InputIterator2 , typename _Tp , typename _BinaryOperation1 , typename _BinaryOperation2 >
constexpr _Tp std::inner_product ( _InputIterator1  __first1,
_InputIterator1  __last1,
_InputIterator2  __first2,
_Tp  __init,
_BinaryOperation1  __binary_op1,
_BinaryOperation2  __binary_op2 
)
inlineconstexpr

Compute inner product of two ranges.

Starting with an initial value of __init, applies __binary_op2 to successive elements from the two ranges and accumulates each result into the accumulated value using __binary_op1. The values in the ranges are processed in order.

Parameters
__first1Start of range 1.
__last1End of range 1.
__first2Start of range 2.
__initStarting value to add other values to.
__binary_op1Function object to accumulate with.
__binary_op2Function object to apply to pairs of input values.
Returns
The final inner product.

Definition at line 223 of file stl_numeric.h.

◆ iota()

template<typename _ForwardIterator , typename _Tp >
constexpr void std::iota ( _ForwardIterator  __first,
_ForwardIterator  __last,
_Tp  __value 
)
constexpr

Create a range of sequentially increasing values.

For each element in the range [first,last) assigns value and increments value as if by ++value.

Parameters
__firstStart of range.
__lastEnd of range.
__valueStarting value.
Returns
Nothing.

Definition at line 88 of file stl_numeric.h.

◆ partial_sum() [1/2]

template<typename _InputIterator , typename _OutputIterator >
constexpr _OutputIterator std::partial_sum ( _InputIterator  __first,
_InputIterator  __last,
_OutputIterator  __result 
)
constexpr

Return list of partial sums.

Accumulates the values in the range [first,last) using the + operator. As each successive input value is added into the total, that partial sum is written to __result. Therefore, the first value in __result is the first value of the input, the second value in __result is the sum of the first and second input values, and so on.

Parameters
__firstStart of input range.
__lastEnd of input range.
__resultOutput sum.
Returns
Iterator pointing just beyond the values written to __result.

Definition at line 256 of file stl_numeric.h.

Referenced by __gnu_parallel::__parallel_random_shuffle_drs_pu(), and __gnu_parallel::__sequential_random_shuffle().

◆ partial_sum() [2/2]

template<typename _InputIterator , typename _OutputIterator , typename _BinaryOperation >
constexpr _OutputIterator std::partial_sum ( _InputIterator  __first,
_InputIterator  __last,
_OutputIterator  __result,
_BinaryOperation  __binary_op 
)
constexpr

Return list of partial sums.

Accumulates the values in the range [first,last) using __binary_op. As each successive input value is added into the total, that partial sum is written to __result. Therefore, the first value in __result is the first value of the input, the second value in __result is the sum of the first and second input values, and so on.

Parameters
__firstStart of input range.
__lastEnd of input range.
__resultOutput sum.
__binary_opFunction object.
Returns
Iterator pointing just beyond the values written to __result.

Definition at line 298 of file stl_numeric.h.