www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Statistical aggregator

Hi all,

In case it's useful to anyone, here's a little statistical aggregator I put
together (source file attached).  This is for online calculation of statistical
quantities and incidentally offers an efficient way to calculate standard
deviation in a single pass over data, using the algorithm described in this

One design decision I'm not sure about -- in the case that this aggregator is
given ranges of ranges as input, it will aggregate over every single element in
the ranges of ranges (... of ranges of ranges of ranges ...).  This is confirmed
in the unittests.  I'm not sure if this is really a feature or a design flaw --
comments welcome (and about any other aspects of the design).

Best wishes,

     -- Joe
Jun 06 2013