Class GeometricMeanCalculator

  • All Implemented Interfaces:
    Function<double[],​Double>

    public class GeometricMeanCalculator
    extends Object
    implements Function<double[],​Double>
    Calculates the geometric mean of a series of data.

    The geometric mean $\mu$ of a series of elements $x_1, x_2, \dots, x_n$ is given by: $$ \begin{align*} \mu = \left({\prod\limits_{i=1}^n x_i}\right)^{\frac{1}{n}} \end{align*} $$

    • Constructor Detail

      • GeometricMeanCalculator

        public GeometricMeanCalculator()
    • Method Detail

      • apply

        public Double apply​(double[] x)
        Specified by:
        apply in interface Function<double[],​Double>
        Parameters:
        x - The array of data, not null or empty
        Returns:
        The geometric mean