Boost logo

Boost :

Subject: Re: [boost] Interest in algorithm for arithmetic mean of integers
From: Bjorn Reese (breese_at_[hidden])
Date: 2015-09-06 07:46:12


On 09/05/2015 09:20 PM, Matt Calabrese wrote:

> Your sample array isn't too interesting in terms of the state changes, so
> here's a more complex one for the array {11, 17, 3, 31, 27}
>
> State : 0 0/0
> Incremented State: 0 0/1
>
> State : 11 0/1
> Incremented State: 5 1/2
>
> State : 14 0/2
> Incremented State: 9 1/3
>
> State : 10 1/3
> Incremented State: 7 3/4
>
> State : 15 2/4
> Incremented State: 12 2/5
>
> State : 17 4/5

I still do not understand how you calculate these state values, but
looking at them it becomes clear that the average M[i] at iteration i
is given by (assuming W[i] is the first entry in the state tuple at
iteration i)

   M[i] = W[i] + (N[i] / D[i])

I am wondering if you can also calculate the running sum from the
state variables by?

   S[i] = W[i] * D[i] + N[i]

> Anyway, it seems like there's interest so I'll try to release it. What
> exactly is the review process for adding algorithms, or is it still
> somewhat informal?

If they are to be added to Boost.Algorithm, then you need to get the
interest of the maintainer. He will decide what level of review is
needed, if any.


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