assumeZeroMean
import mir.math.common: approxEqual; import mir.stat.transform: center; import mir.ndslice.slice: sliced; auto a = [0.0, 1.0, 1.5, 2.0, 3.5, 4.25, 2.0, 7.5, 5.0, 1.0, 1.5, 0.0].sliced; auto x = a.center; VarianceAccumulator!(double, VarianceAlgo.assumeZeroMean, Summation.naive) v; v.put(x); assert(v.variance(true).approxEqual(54.76562 / 12)); assert(v.variance(false).approxEqual(54.76562 / 11)); v.put(4.0); assert(v.variance(true).approxEqual(70.76562 / 13)); assert(v.variance(false).approxEqual(70.76562 / 12));