
On Fri, Sep 4, 2015 at 11:20 AM, Matt Calabrese <rivorus@gmail.com> wrote:
////////// auto result = mean(std::begin(range), std::end(range)); //////////
At the moment I do not have an implementation that works piecemeal as is akin to Boost.Accumulators, however since the implementation of the algorithm really is simply a call to std::accumulate, it should be very simple to expose such a form, and I imagine that it would be especially useful. Some further details on how the state is manipulated with each iteration:
I also do not support weighted averages yet, but it should be possible. In that case, I imagine that integral weights could be specified with the precondition of the algorithm being that the sum of the weights needs to be <= std::numeric_limits<difference_type>::max(). With such a precondition, I believe it's possible to produce an exact result using the same mixed number type that was described earlier. -- -Matt Calabrese