/** * Returns the geometric mean of the entries in the specified portion * of the input array. * <p> * See {@link GeometricMean} for details on the computing algorithm.</p> * <p> * Throws <code>IllegalArgumentException</code> if the array is null.</p> * * @param values input array containing the values * @param begin first array element to include * @param length the number of elements to include * @return the geometric mean or Double.NaN if length = 0 or * any of the values are <= 0. * @throws IllegalArgumentException if the input array is null or the array * index parameters are not valid */ @Override public double evaluate( final double[] values, final int begin, final int length) { return Math.exp( sumOfLogs.evaluate(values, begin, length) / length); }
/** * Returns the geometric mean of the entries in the specified portion * of the input array. * <p> * See {@link GeometricMean} for details on the computing algorithm.</p> * <p> * Throws <code>IllegalArgumentException</code> if the array is null.</p> * * @param values input array containing the values * @param begin first array element to include * @param length the number of elements to include * @return the geometric mean or Double.NaN if length = 0 or * any of the values are <= 0. * @throws IllegalArgumentException if the input array is null or the array * index parameters are not valid */ public double evaluate( final double[] values, final int begin, final int length) { return Math.exp( sumOfLogs.evaluate(values, begin, length) / (double) length); }
/** * Returns the geometric mean of the entries in the specified portion * of the input array. * <p> * See {@link GeometricMean} for details on the computing algorithm.</p> * <p> * Throws <code>IllegalArgumentException</code> if the array is null.</p> * * @param values input array containing the values * @param begin first array element to include * @param length the number of elements to include * @return the geometric mean or Double.NaN if length = 0 or * any of the values are <= 0. * @throws IllegalArgumentException if the input array is null or the array * index parameters are not valid */ @Override public double evaluate( final double[] values, final int begin, final int length) { return FastMath.exp( sumOfLogs.evaluate(values, begin, length) / length); }