Boost logo

Boost :

Subject: Re: [boost] Interest in algorithm for arithmetic mean of integers
From: Seth (bugs_at_[hidden])
Date: 2015-09-17 12:40:07


On 09/17/2015 04:13 PM, Marshall Clow wrote:
> On Sat, Sep 5, 2015 at 12:20 PM, Matt Calabrese <rivorus_at_[hidden]> wrote:
>
> The algorithm should be able to be adapted to introduce weights. It would
> work very similarly, only when advancing the state, it would be based on
> the weight rather than always effectively using (D+1). Similarly, the
> denominator would no longer always exactly match the number of elements,
> but instead it would always match the sum of the weights that were
> encountered. I haven't implemented this weighted variation, but it
> shouldn't be too much of a change.
I think Boost Accumulator already does these.

E.g.
http://www.boost.org/doc/libs/1_59_0/doc/html/accumulators/user_s_guide.html#accumulators.user_s_guide.the_accumulators_framework.weighted_samples

Seth


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