26 #ifndef MLN_ACCU_CONVOLVE_HH
27 # define MLN_ACCU_CONVOLVE_HH
33 # include <mln/accu/internal/base.hh>
34 # include <mln/value/ops.hh>
35 # include <mln/literal/zero.hh>
52 template <
typename T1,
typename T2,
53 typename R = mln_sum_product(T1, T2)>
54 struct convolve :
public mln::accu::internal::base< R, convolve<T1,T2,R> >,
58 typedef std::pair<T1,T2> argument;
65 void take(
const argument& t);
66 void take(
const T1& t1,
const T2& t2);
79 typedef mln_sum_product(T1, T2) S;
84 # ifndef MLN_INCLUDE_ONLY
86 template <
typename T1,
typename T2,
typename R>
93 template <
typename T1,
typename T2,
typename R>
102 template <
typename T1,
typename T2,
typename R>
107 s_ =
static_cast<S
>(s_ +
static_cast<S
>(t.first) * static_cast<S>(t.second));
110 template <
typename T1,
typename T2,
typename R>
113 convolve<T1,T2,R>::take(
const T1& t1,
const T2& t2)
115 s_ =
static_cast<S
>(s_ +
static_cast<S
>(t1) * static_cast<S>(t2));
118 template <
typename T1,
typename T2,
typename R>
121 convolve<T1,T2,R>::take(
const convolve<T1,T2,R>& other)
123 s_ =
static_cast<S
>(s_ + other.s_);
126 template <
typename T1,
typename T2,
typename R>
134 template <
typename T1,
typename T2,
typename R>
142 # endif // ! MLN_INCLUDE_ONLY
149 #endif // ! MLN_ACCU_CONVOLVE_HH