6.10.94-stable

Gaussian Profile

A GaussianProfile represents a collection of Gaussian objects.

Therefore the methods are similar to those of Gaussian, except for the additional slot parameter, to select one of the Gaussians.

For example:

use util;

fn main() {
  var gprof = GaussianProfile::new(2);

  for (var x = 0; x < 10; x++) {
    gprof.add(0, x as float);  // cast
    gprof.add(1, 2*x as float);
  }

  for (var i = 0; i < gprof.getSlots(); i++) {
    println("${i}: avg=${gprof.avg(i)}, std=${gprof.std(i)}");
  }
}

Displays:

0: avg=4.5, std=3.0276503541
1: avg=9.0, std=6.0553007082

The other methods are:

  native fn add(slot: int, value: float);
  native fn avg(slot: int): float;
  native fn std(slot: int): float;
  native fn min(slot: int): float;
  native fn max(slot: int): float;
  native fn sum(slot: int): float;
  native fn sumsq(slot: int): float;
  native fn size(slot: int): int;
  native fn getSlots(): int;