/** * {@inheritDoc} */ @Override public void clear() { sumOfLogs.clear(); }
/** * {@inheritDoc} */ @Override public void increment(final double d) { sumOfLogs.increment(d); }
/** * Returns the maximum of the values that have been added. * <p> * Double.NaN is returned if no values have been added. * </p> * @return the maximum */ public double getMax() { return maxImpl.getResult(); }
/** * {@inheritDoc} */ public long getN() { return sumOfLogs.getN(); }
/** * 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); }
/** * Copies source to dest. * <p>Neither source nor dest can be null.</p> * * @param source GeometricMean to copy * @param dest GeometricMean to copy to * @throws NullPointerException if either source or dest is null */ public static void copy(GeometricMean source, GeometricMean dest) { dest.sumOfLogs = source.sumOfLogs.copy(); }
/** * Returns the sum of the squares of the values that have been added. * <p> * Double.NaN is returned if no values have been added. * </p> * @return The sum of squares */ public double getSumsq() { return sumsqImpl.getResult(); }
/** * @see org.apache.commons.math.stat.descriptive.StorelessUnivariateStatistic#getN() */ public long getN() { return sumOfLogs.getN(); }
/** * 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); }
/** * Copies source to dest. * <p>Neither source nor dest can be null.</p> * * @param source GeometricMean to copy * @param dest GeometricMean to copy to * @throws NullPointerException if either source or dest is null */ public static void copy(GeometricMean source, GeometricMean dest) { dest.setData(source.getDataRef()); dest.sumOfLogs = source.sumOfLogs.copy(); }
/** * Returns the maximum of the values that have been added. * <p> * Double.NaN is returned if no values have been added. * </p> * @return the maximum */ public double getMax() { return maxImpl.getResult(); }
/** * {@inheritDoc} */ @Override public void increment(final double d) { sumOfLogs.increment(d); }
/** * @see org.apache.commons.math.stat.descriptive.StorelessUnivariateStatistic#clear() */ public void clear() { sumOfLogs.clear(); }
/** * {@inheritDoc} */ public long getN() { return sumOfLogs.getN(); }
/** * 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); }
dest.maxImpl = source.maxImpl.copy(); dest.meanImpl = source.meanImpl.copy(); dest.minImpl = source.minImpl.copy(); dest.sumImpl = source.sumImpl.copy(); dest.varianceImpl = source.varianceImpl.copy(); dest.sumLogImpl = source.sumLogImpl.copy(); dest.sumsqImpl = source.sumsqImpl.copy(); if (source.getGeoMeanImpl() instanceof GeometricMean) { dest.geoMeanImpl = source.geoMeanImpl.copy();
/** * Returns the sum of the values that have been added * @return The sum or <code>Double.NaN</code> if no values have been added */ public double getSum() { return sumImpl.getResult(); }