List of utility methods to do Geometric Mean
double | geometricMean(double a, double b) geometric Mean return Math.pow(a * b, 0.5);
|
double | geometricMean(double... values) geometric Mean return Math.pow(product(values), 1. / values.length);
|
double | geometricMean(double[] nums) Return the geometric mean of an array of numbers. double prod = 1.0; for (double num : nums) { prod *= num; return Math.pow(prod, 1.0 / (double) nums.length); |
double | geometricMean(double[] values) Calculates the geometric mean The geometric mean is the product of all values in the array to the Nth root, where N is the total number of values in the array. double geometricMean; int size = values.length; double[] logValues = new double[size]; for (int i = 0; i < size; i++) { logValues[i] = Math.log(values[i]); geometricMean = geometricMeanFromLog(logValues); return geometricMean; ... |
double | geometricMean(final double[] values) Returns the geometric mean of the entries in the input array. return (geometricMean(values, null));
|
float | geometricMean(float[] xs) geometric Mean if (xs == null || xs.length == 0) throw new IllegalArgumentException("Input to mean() is an empty array"); float prod = 1.0f; for (int i = 0; i < xs.length; ++i) prod *= xs[i]; return (float) Math.pow((double) prod, 1.0 / xs.length); |
double | geometricMeanFromLog(double[] logValues) Calculates the geometric mean of log values. double logArithmeticMean = arithmeticMean(logValues); double geometricMean = Math.exp(logArithmeticMean); return geometricMean; |