Next : , Previous : Accumulate, Top : Table of  Contents


Inner product

T inner_product (InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, T init) Function
T inner_product (InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, T init, BinaryOperation1 binary_op1, BinaryOperation2 binary_op2) Function

template 
T inner_product(InputIterator1 first1, InputIterator1 last1,
                InputIterator2 first2, T init);

template 
T inner_product(InputIterator1 first1, InputIterator1 last1,
                InputIterator2 first2, T init,
                BinaryOperation1 binary_op1, BinaryOperation2 binary_op2);

inner_product computes its result by initializing the accumulator acc with the initial value init and then modifying it with acc = acc + (*i1) * (*i2) or
acc = binary_op1(acc,binary_op2(*i1,*i2))
for every iterator i1 in the range [first, last) and iterator i2 in the range [first2,first2+(last - first)) in order. binary_op1 and binary_op2 are assumed not to cause side effects.


 

Top