19
19
* \brief Inline file for inner_product.h.
22
#include <thrust/generate.h>
22
#include <thrust/detail/config.h>
23
#include <thrust/inner_product.h>
23
24
#include <thrust/iterator/iterator_traits.h>
24
25
#include <thrust/system/detail/generic/select_system.h>
25
26
#include <thrust/system/detail/generic/inner_product.h>
26
#include <thrust/detail/adl_helper.h>
27
#include <thrust/system/detail/adl/inner_product.h>
33
template<typename DerivedPolicy,
34
typename InputIterator1,
35
typename InputIterator2,
37
OutputType inner_product(const thrust::detail::execution_policy_base<DerivedPolicy> &exec,
38
InputIterator1 first1,
40
InputIterator2 first2,
43
using thrust::system::detail::generic::inner_product;
44
return inner_product(thrust::detail::derived_cast(thrust::detail::strip_const(exec)), first1, last1, first2, init);
45
} // end inner_product()
48
template<typename DerivedPolicy,
49
typename InputIterator1,
50
typename InputIterator2,
52
typename BinaryFunction1,
53
typename BinaryFunction2>
54
OutputType inner_product(const thrust::detail::execution_policy_base<DerivedPolicy> &exec,
55
InputIterator1 first1,
57
InputIterator2 first2,
59
BinaryFunction1 binary_op1,
60
BinaryFunction2 binary_op2)
62
using thrust::system::detail::generic::inner_product;
63
return inner_product(thrust::detail::derived_cast(thrust::detail::strip_const(exec)), first1, last1, first2, init, binary_op1, binary_op2);
64
} // end inner_product()
32
67
template <typename InputIterator1, typename InputIterator2, typename OutputType>
34
69
inner_product(InputIterator1 first1, InputIterator1 last1,
35
70
InputIterator2 first2, OutputType init)
37
72
using thrust::system::detail::generic::select_system;
38
using thrust::system::detail::generic::inner_product;
40
typedef typename thrust::iterator_system<InputIterator1>::type system1;
41
typedef typename thrust::iterator_system<InputIterator2>::type system2;
43
return inner_product(select_system(system1(),system2()), first1, last1, first2, init);
74
typedef typename thrust::iterator_system<InputIterator1>::type System1;
75
typedef typename thrust::iterator_system<InputIterator2>::type System2;
80
return thrust::inner_product(select_system(system1,system2), first1, last1, first2, init);
44
81
} // end inner_product()
46
84
template <typename InputIterator1, typename InputIterator2, typename OutputType,
47
85
typename BinaryFunction1, typename BinaryFunction2>
51
89
BinaryFunction1 binary_op1, BinaryFunction2 binary_op2)
53
91
using thrust::system::detail::generic::select_system;
54
using thrust::system::detail::generic::inner_product;
56
typedef typename thrust::iterator_system<InputIterator1>::type system1;
57
typedef typename thrust::iterator_system<InputIterator2>::type system2;
59
return inner_product(select_system(system1(),system2()), first1, last1, first2, init, binary_op1, binary_op2);
93
typedef typename thrust::iterator_system<InputIterator1>::type System1;
94
typedef typename thrust::iterator_system<InputIterator2>::type System2;
99
return thrust::inner_product(select_system(system1,system2), first1, last1, first2, init, binary_op1, binary_op2);
60
100
} // end inner_product()