/** * Returns the geometric mean of the entries in the specified portion of the input array, or * <code>Double.NaN</code> if the designated subarray is empty. * * <p>Throws <code>IllegalArgumentException</code> if the array is null. * * <p>See {@link org.apache.commons.math3.stat.descriptive.moment.GeometricMean} for details on * the computing algorithm. * * @param values the input array * @param begin index of the first array element to include * @param length the number of elements to include * @return the geometric mean of the values or Double.NaN if length = 0 * @throws MathIllegalArgumentException if the array is null or the array index parameters are not * valid */ public static double geometricMean(final double[] values, final int begin, final int length) throws MathIllegalArgumentException { return GEOMETRIC_MEAN.evaluate(values, begin, length); }
/** * Returns the geometric mean of the entries in the input array, or <code>Double.NaN</code> if the * array is empty. * * <p>Throws <code>IllegalArgumentException</code> if the array is null. * * <p>See {@link org.apache.commons.math3.stat.descriptive.moment.GeometricMean} for details on * the computing algorithm. * * @param values the input array * @return the geometric mean of the values or Double.NaN if the array is empty * @throws MathIllegalArgumentException if the array is null */ public static double geometricMean(final double[] values) throws MathIllegalArgumentException { return GEOMETRIC_MEAN.evaluate(values); }