~ubuntu-branches/ubuntu/utopic/libthrust/utopic

« back to all changes in this revision

Viewing changes to detail/inner_product.inl

  • Committer: Package Import Robot
  • Author(s): Andreas Beckmann
  • Date: 2013-07-10 12:57:33 UTC
  • mfrom: (1.1.4)
  • Revision ID: package-import@ubuntu.com-20130710125733-my19jic71sqsabaj
Tags: 1.7.0-1
* New upstream release.  (Closes: #715362)
* Update watch file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
 *  \brief Inline file for inner_product.h.
20
20
 */
21
21
 
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>
27
28
 
28
29
namespace thrust
29
30
{
30
31
 
31
32
 
 
33
template<typename DerivedPolicy,
 
34
         typename InputIterator1,
 
35
         typename InputIterator2,
 
36
         typename OutputType>
 
37
OutputType inner_product(const thrust::detail::execution_policy_base<DerivedPolicy> &exec,
 
38
                         InputIterator1 first1,
 
39
                         InputIterator1 last1,
 
40
                         InputIterator2 first2,
 
41
                         OutputType init)
 
42
{
 
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()
 
46
 
 
47
 
 
48
template<typename DerivedPolicy,
 
49
         typename InputIterator1,
 
50
         typename InputIterator2,
 
51
         typename OutputType,
 
52
         typename BinaryFunction1,
 
53
         typename BinaryFunction2>
 
54
OutputType inner_product(const thrust::detail::execution_policy_base<DerivedPolicy> &exec,
 
55
                         InputIterator1 first1,
 
56
                         InputIterator1 last1,
 
57
                         InputIterator2 first2,
 
58
                         OutputType init, 
 
59
                         BinaryFunction1 binary_op1,
 
60
                         BinaryFunction2 binary_op2)
 
61
{
 
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()
 
65
 
 
66
 
32
67
template <typename InputIterator1, typename InputIterator2, typename OutputType>
33
68
OutputType 
34
69
inner_product(InputIterator1 first1, InputIterator1 last1,
35
70
              InputIterator2 first2, OutputType init)
36
71
{
37
72
  using thrust::system::detail::generic::select_system;
38
 
  using thrust::system::detail::generic::inner_product;
39
 
 
40
 
  typedef typename thrust::iterator_system<InputIterator1>::type system1;
41
 
  typedef typename thrust::iterator_system<InputIterator2>::type system2;
42
 
 
43
 
  return inner_product(select_system(system1(),system2()), first1, last1, first2, init);
 
73
 
 
74
  typedef typename thrust::iterator_system<InputIterator1>::type System1;
 
75
  typedef typename thrust::iterator_system<InputIterator2>::type System2;
 
76
 
 
77
  System1 system1;
 
78
  System2 system2;
 
79
 
 
80
  return thrust::inner_product(select_system(system1,system2), first1, last1, first2, init);
44
81
} // end inner_product()
45
82
 
 
83
 
46
84
template <typename InputIterator1, typename InputIterator2, typename OutputType,
47
85
          typename BinaryFunction1, typename BinaryFunction2>
48
86
OutputType
51
89
              BinaryFunction1 binary_op1, BinaryFunction2 binary_op2)
52
90
{
53
91
  using thrust::system::detail::generic::select_system;
54
 
  using thrust::system::detail::generic::inner_product;
55
 
 
56
 
  typedef typename thrust::iterator_system<InputIterator1>::type system1;
57
 
  typedef typename thrust::iterator_system<InputIterator2>::type system2;
58
 
 
59
 
  return inner_product(select_system(system1(),system2()), first1, last1, first2, init, binary_op1, binary_op2);
 
92
 
 
93
  typedef typename thrust::iterator_system<InputIterator1>::type System1;
 
94
  typedef typename thrust::iterator_system<InputIterator2>::type System2;
 
95
 
 
96
  System1 system1;
 
97
  System2 system2;
 
98
 
 
99
  return thrust::inner_product(select_system(system1,system2), first1, last1, first2, init, binary_op1, binary_op2);
60
100
} // end inner_product()
61
101
 
62
102