The OpenD Programming Language

SkewnessAccumulator

  1. struct SkewnessAccumulator(T, SkewnessAlgo skewnessAlgo, Summation summation)
  2. struct SkewnessAccumulator(T, SkewnessAlgo skewnessAlgo, Summation summation)
  3. struct SkewnessAccumulator(T, SkewnessAlgo skewnessAlgo, Summation summation)
  4. struct SkewnessAccumulator(T, SkewnessAlgo skewnessAlgo, Summation summation)
  5. struct SkewnessAccumulator(T, SkewnessAlgo skewnessAlgo, Summation summation)
  6. struct SkewnessAccumulator(T, SkewnessAlgo skewnessAlgo, Summation summation)

Constructors

this
this(Slice!(Iterator, N, kind) slice)
this
this(SliceLike x)
this
this(Range range)
this
this(T x)

Members

Aliases

S
alias S = Summator!(T, summation)

Functions

centeredSumOfCubes
F centeredSumOfCubes()
centeredSumOfSquares
F centeredSumOfSquares()
count
size_t count()
mean
F mean()
put
void put(Range r)
put
void put(T x)
put
void put(SkewnessAccumulator!(U, skewAlgo, sumAlgo) v)
scaledSumOfCubes
F scaledSumOfCubes(bool isPopulation)
skewness
F skewness(bool isPopulation)
variance
F variance(bool isPopulation)

Examples

hybrid

import mir.math.common: approxEqual, pow;
import mir.math.sum: Summation;
import mir.ndslice.slice: sliced;

auto x = [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 v = SkewnessAccumulator!(double, SkewnessAlgo.hybrid, Summation.naive)(x);
assert(v.skewness(true).approxEqual((117.005859 / 12) / pow(54.765625 / 12, 1.5)));
assert(v.skewness(false).approxEqual((117.005859 / 12) / pow(54.765625 / 11, 1.5) * (12.0 ^^ 2) / (11.0 * 10.0)));

v.put(4.0);
assert(v.skewness(true).approxEqual((100.238166 / 13) / pow(57.019231 / 13, 1.5)));
assert(v.skewness(false).approxEqual((100.238166 / 13) / pow(57.019231 / 12, 1.5) * (13.0 ^^ 2) / (12.0 * 11.0)));

Meta