absl::c_inner_product

c_inner_product overloads

Synopses

Declared in <absl/algorithm/container.h>

Container-based version of the <numeric> std::inner_product() function to compute the cumulative inner product of container element pairs.

template<
    typename Sequence1,
    typename Sequence2,
    typename T>
constexpr
std::decay_t<T>
c_inner_product(
    Sequence1 const& factors1,
    Sequence2 const& factors2,
    T&& sum);
» more...

Overload of c_inner_product() for using binary operations other than operator+ (for computing the accumulation) and operator* (for computing the product between the two container's element pair).

template<
    typename Sequence1,
    typename Sequence2,
    typename T,
    typename BinaryOp1,
    typename BinaryOp2>
constexpr
std::decay_t<T>
c_inner_product(
    Sequence1 const& factors1,
    Sequence2 const& factors2,
    T&& sum,
    BinaryOp1&& op1,
    BinaryOp2&& op2);
» more...

Return Value

The computed inner product.

Parameters

NameDescription
factors1The first container of factors.
factors2The second container of factors.
sumThe initial value of the accumulation.
op1The binary operation used to accumulate the products.
op2The binary operation used to combine element pairs.