1 #ifndef _RHEO_DIS_INNER_PRODUCT_H
2 #define _RHEO_DIS_INNER_PRODUCT_H
24 #include "rheolef/promote.h"
25 #include "rheolef/communicator.h"
67 template <
class InputIterator1,
class InputIterator2,
class Size>
69 typename std::iterator_traits<InputIterator1>::value_type,
70 typename std::iterator_traits<InputIterator2>::value_type
73 InputIterator1 first1,
74 InputIterator2 first2,
79 typedef typename std::iterator_traits<InputIterator1>::value_type
T;
81 for (Size i = 0; i <
n; ++i, ++first1, ++first2) {
82 sum = sum + (*first1)*(*first2);
86 #ifdef _RHEOLEF_HAVE_MPI
87 template <
class InputIterator1,
class InputIterator2,
class Size>
90 typename std::iterator_traits<InputIterator1>::value_type,
91 typename std::iterator_traits<InputIterator2>::value_type
94 InputIterator1 first1,
95 InputIterator2 first2,
100 typedef typename std::iterator_traits<InputIterator1>::value_type
T;
102 return mpi::all_reduce (comm, local_sum, std::plus<T>());
106 template <
class InputIterator1,
class InputIterator2,
class Size>
109 typename std::iterator_traits<InputIterator1>::value_type,
110 typename std::iterator_traits<InputIterator2>::value_type
113 InputIterator1 first1,
114 InputIterator2 first2,
communicator communicator_type
#define rheo_default_memory_model
This file is part of Rheolef.
promote< typename std::iterator_traits< InputIterator1 >::value_type, typename std::iterator_traits< InputIterator2 >::value_type >::type dis_inner_product(InputIterator1 first1, InputIterator2 first2, Size n, const distributor::communicator_type &comm, sequential)