The OpenD Programming Language

MeanAccumulator

Output range for mean.

Members

Functions

mean
F mean()
put
void put(Range r)
put
void put(T x)
put
void put(MeanAccumulator!(F, summation) m)
sum
F sum()

Variables

count
size_t count;
summator
Summator!(T, summation) summator;

Examples

import mir.ndslice.slice: sliced;

MeanAccumulator!(double, Summation.pairwise) x;
x.put([0.0, 1, 2, 3, 4].sliced);
assert(x.mean == 2);
x.put(5);
assert(x.mean == 2.5);

Meta