Boost logo

Boost :

Subject: Re: [boost] accumulators + complex
From: Neal Becker (ndbecker2_at_[hidden])
Date: 2008-12-19 08:29:06


Neal Becker wrote:

> I'm interested in 2nd order stats for complex numbers.
>
> typedef std::complex<double> complex_t;
> typedef accumulator_set<complex_t, stats<tag::mean, tag::moment<2> > >
> acc_t;
>
> 2 issues:
>
> 1) Need
> template<typename flt_t>
> inline std::complex<flt_t> operator/ (std::complex<flt_t> const& a,
> unsigned long int b) {
> return std::complex<flt_t> (real (a)/b, imag (a)/b);
> }
>
> 2) What do I get for moment<2> in the case of complex (and does this match
> the usual mathematical definition?)
>

I believe what I want to is mean, and
\sum |x- mean(x)|**2

Can I do this with accumlators framework?


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk