1[/
2    Copyright 2010 Neil Groves
3    Distributed under the Boost Software License, Version 1.0.
4    (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5/]
6[section:inner_product inner_product]
7
8[heading Prototype]
9
10``
11template<class SinglePassRange1,
12         class SinglePassRange2,
13         class Value>
14    Value inner_product( const SinglePassRange1& rng1,
15                         const SinglePassRange2& rng2,
16                         Value                   init );
17
18template<class SinglePassRange1,
19         class SinglePassRange2,
20         class Value,
21         class BinaryOperation1,
22         class BinaryOperation2>
23    Value inner_product( const SinglePassRange1& rng1,
24                         const SinglePassRange2& rng2,
25                         Value                   init,
26                         BinaryOperation1        op1,
27                         BinaryOperation2        op2 );
28``
29
30[heading Description]
31
32`inner_product` calculates a generalised inner product of the range `rng1` and `rng2`.
33
34For further information on the `inner_product` algorithm please see __sgi_inner_product__.
35
36[heading Definition]
37
38Defined in the header file `boost/range/numeric.hpp`
39
40[heading Requirements]
41
42[heading For the first version]
43
44# `SinglePassRange1` is a model of the __single_pass_range__ Concept.
45# `SinglePassRange2` is a model of the __single_pass_range__ Concept.
46# `Value` is a model of the `AssignableConcept`.
47# If `x` is an object of type `Value`, `y` is an object of `SinglePassRange1`'s value
48type, and `z` is an object of `SinglePassRange2`'s value type, then `x + y * z`
49is defined.
50# The result type of the expression `x + y * z` is convertible to `Value`.
51
52[heading For the second version]
53
54# `SinglePassRange1` is a model of the __single_pass_range__ Concept.
55# `SinglePassRange2` is a model of the __single_pass_range__ Concept.
56# `Value` is a model of the `AssignableConcept`.
57# `BinaryOperation1` is a model of the `BinaryFunctionConcept`.
58# `BinaryOperation2` is a model of the `BinaryFunctionConcept`.
59# The value type of `SinglePassRange1` is convertible to the first argument type of `BinaryOperation2`.
60# The value type of `SinglePassRange2` is convertible to the second argument type of `BinaryOperation2`.
61# `Value` is convertible to the value type of `BinaryOperation1`.
62# The return type of `BinaryOperation2` is convertible to the second argument type of `BinaryOperation1`.
63# The return type of `BinaryOperation1` is convertible to `Value`.
64
65[heading Precondition:]
66
67`distance(rng2) >= distance(rng1)` is a valid range.
68
69[heading Complexity]
70
71Linear. Exactly `distance(rng)`.
72
73[endsect]
74