27 #ifndef MLN_ACCU_MATH_SUMPOW_HH
28 # define MLN_ACCU_MATH_SUMPOW_HH
35 # include <mln/core/concept/meta_accumulator.hh>
36 # include <mln/accu/internal/base.hh>
38 # include <mln/util/pix.hh>
40 # include <mln/trait/value_.hh>
41 # include <mln/value/builtin/all.hh>
42 # include <mln/literal/zero.hh>
48 namespace accu {
namespace math {
template <
unsigned n,
typename T,
typename S>
struct sumpow; } };
54 template <
unsigned n,
typename T,
typename S>
55 struct accumulator_< accu::math::sumpow<n,T,S> >
57 typedef accumulator::has_untake::yes
has_untake;
59 typedef accumulator::has_stop::no
has_stop;
60 typedef accumulator::when_pix::not_ok
when_pix;
76 template <
unsigned n,
typename T,
typename S = mln_sum(T)>
108 template <
unsigned n,
typename I,
typename S>
109 struct sumpow< n, util::pix<I>, S >;
112 # ifndef MLN_INCLUDE_ONLY
116 template <unsigned n, typename T, typename S>
123 template <
unsigned n,
typename T,
typename S>
131 template <
unsigned n,
typename T,
typename S>
135 s_ += std::pow(static_cast<S>(t), n);
138 template <
unsigned n,
typename T,
typename S>
142 s_ -= std::pow(static_cast<S>(t), n);
145 template <
unsigned n,
typename T,
typename S>
149 s_ = std::pow(static_cast<S>(t), n);
152 template <
unsigned n,
typename T,
typename S>
160 template <
unsigned n,
typename T,
typename S>
168 template <
unsigned n,
typename T,
typename S>
176 template <
unsigned n,
typename T,
typename S>
184 template <
unsigned n,
typename T,
typename S>
192 # endif // ! MLN_INCLUDE_ONLY
201 #endif // ! MLN_ACCU_MATH_SUMPOW_HH