Interface Quantiler

All Known Implementing Classes:
GKQuantiler, SortQuantiler

public interface Quantiler
Calculates quantile values given a sequence of data samples.

Data must be submitted before quantiles are calculated. The sequence is as follows:

  1. Make zero or more calls to acceptDatum(double) and addQuantiler(uk.ac.starlink.ttools.filter.Quantiler)
  2. Make one or more calls to ready()
  3. Make zero or more calls to getValueAtQuantile(double)
Doing it out of sequence leads to undefined behaviour.
Since:
3 Dec 2020
Author:
Mark Taylor
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    acceptDatum(double value)
    Accepts a value to accumulate for quantile calculations.
    void
    Merges the state of another compatible accumulator into this one; the effect is as if all the acceptDatum(double) calls that were made on other had been made on this one.
    double
    getValueAtQuantile(double quantile)
    Returns the value at a given quantile.
    void
    Call after all data has been accumulated and before quantiles are to be calculated.
  • Method Details

    • acceptDatum

      void acceptDatum(double value)
      Accepts a value to accumulate for quantile calculations. NaN values are ignored.
      Parameters:
      value - value to accumulate
    • addQuantiler

      void addQuantiler(Quantiler other)
      Merges the state of another compatible accumulator into this one; the effect is as if all the acceptDatum(double) calls that were made on other had been made on this one.
      Parameters:
      other - compatible quantiler to merge with this
    • ready

      void ready()
      Call after all data has been accumulated and before quantiles are to be calculated.
    • getValueAtQuantile

      double getValueAtQuantile(double quantile)
      Returns the value at a given quantile.
      Parameters:
      quantile - value in the range 0..1
      Returns:
      value at quantile, or NaN if no data