GeometricMeanAggregator

A GeometricMeanAggregator is an Aggregator that calculates the geometric mean of numeric values, returning the geometric mean as a Double. If no values were encountered, then the returned geometric mean is Double.NaN. This Aggregator overrides the terminateDoubleDouble method, so that the geometric mean is also available as a DoubleDouble. This allows the geometric mean to be used by other Aggregators as a high-precision DoubleDouble.

Usage

Create and use a GeometricMeanAggregator, with one of the following methods:

  • Aggregator agg = new GeometricMeanAggregator("property");
  • Aggregator agg = Aggregator.getAggregator("GeometricMean(property)");

The values returned by the property of the object must be numeric.

The geometric mean is calculated by taking the n-th root of the product of all values.