/** * Returns the <a href="http://en.wikipedia.org/wiki/Arithmetic_mean">arithmetic mean</a> of * {@code values}. * * <p>If these values are a sample drawn from a population, this is also an unbiased estimator of * the arithmetic mean of the population. * * @param values a nonempty series of values * @throws IllegalArgumentException if {@code values} is empty or contains any non-finite value * @deprecated Use {@link Stats#meanOf} instead, noting the less strict handling of non-finite * values. */ @Deprecated // com.google.common.math.DoubleUtils @GwtIncompatible public static double mean(double... values) { checkArgument(values.length > 0, "Cannot take mean of 0 values"); long count = 1; double mean = checkFinite(values[0]); for (int index = 1; index < values.length; ++index) { checkFinite(values[index]); count++; // Art of Computer Programming vol. 2, Knuth, 4.2.2, (15) mean += (values[index] - mean) / count; } return mean; }
/** * Returns the <a href="http://en.wikipedia.org/wiki/Arithmetic_mean">arithmetic mean</a> of * {@code values}. * * <p>If these values are a sample drawn from a population, this is also an unbiased estimator of * the arithmetic mean of the population. * * @param values a nonempty series of values, which will be converted to {@code double} values * (this may cause loss of precision) * @throws IllegalArgumentException if {@code values} is empty or contains any non-finite value * @deprecated Use {@link Stats#meanOf} instead, noting the less strict handling of non-finite * values. */ @Deprecated // com.google.common.math.DoubleUtils @GwtIncompatible public static double mean(Iterator<? extends Number> values) { checkArgument(values.hasNext(), "Cannot take mean of 0 values"); long count = 1; double mean = checkFinite(values.next().doubleValue()); while (values.hasNext()) { double value = checkFinite(values.next().doubleValue()); count++; // Art of Computer Programming vol. 2, Knuth, 4.2.2, (15) mean += (value - mean) / count; } return mean; }
/** * Returns the <a href="http://en.wikipedia.org/wiki/Arithmetic_mean">arithmetic mean</a> of * {@code values}. * * <p>If these values are a sample drawn from a population, this is also an unbiased estimator of * the arithmetic mean of the population. * * @param values a nonempty series of values * @throws IllegalArgumentException if {@code values} is empty or contains any non-finite value * @deprecated Use {@link Stats#meanOf} instead, noting the less strict handling of non-finite * values. */ @Deprecated // com.google.common.math.DoubleUtils @GwtIncompatible public static double mean(double... values) { checkArgument(values.length > 0, "Cannot take mean of 0 values"); long count = 1; double mean = checkFinite(values[0]); for (int index = 1; index < values.length; ++index) { checkFinite(values[index]); count++; // Art of Computer Programming vol. 2, Knuth, 4.2.2, (15) mean += (values[index] - mean) / count; } return mean; }
/** * Returns the <a href="http://en.wikipedia.org/wiki/Arithmetic_mean">arithmetic mean</a> of * {@code values}. * * <p>If these values are a sample drawn from a population, this is also an unbiased estimator of * the arithmetic mean of the population. * * @param values a nonempty series of values, which will be converted to {@code double} values * (this may cause loss of precision) * @throws IllegalArgumentException if {@code values} is empty or contains any non-finite value * @deprecated Use {@link Stats#meanOf} instead, noting the less strict handling of non-finite * values. */ @Deprecated // com.google.common.math.DoubleUtils @GwtIncompatible public static double mean(Iterator<? extends Number> values) { checkArgument(values.hasNext(), "Cannot take mean of 0 values"); long count = 1; double mean = checkFinite(values.next().doubleValue()); while (values.hasNext()) { double value = checkFinite(values.next().doubleValue()); count++; // Art of Computer Programming vol. 2, Knuth, 4.2.2, (15) mean += (value - mean) / count; } return mean; }
/** * Returns the <a href="http://en.wikipedia.org/wiki/Arithmetic_mean">arithmetic mean</a> of * {@code values}. * * <p>If these values are a sample drawn from a population, this is also an unbiased estimator of * the arithmetic mean of the population. * * @param values a nonempty series of values * @throws IllegalArgumentException if {@code values} is empty or contains any non-finite value * @deprecated Use {@link Stats#meanOf} instead, noting the less strict handling of non-finite * values. */ @Deprecated // com.google.common.math.DoubleUtils @GwtIncompatible public static double mean(double... values) { checkArgument(values.length > 0, "Cannot take mean of 0 values"); long count = 1; double mean = checkFinite(values[0]); for (int index = 1; index < values.length; ++index) { checkFinite(values[index]); count++; // Art of Computer Programming vol. 2, Knuth, 4.2.2, (15) mean += (values[index] - mean) / count; } return mean; }
/** * Returns the <a href="http://en.wikipedia.org/wiki/Arithmetic_mean">arithmetic mean</a> of * {@code values}. * * <p>If these values are a sample drawn from a population, this is also an unbiased estimator of * the arithmetic mean of the population. * * @param values a nonempty series of values, which will be converted to {@code double} values * (this may cause loss of precision) * @throws IllegalArgumentException if {@code values} is empty or contains any non-finite value * @deprecated Use {@link Stats#meanOf} instead, noting the less strict handling of non-finite * values. */ @Deprecated // com.google.common.math.DoubleUtils @GwtIncompatible public static double mean(Iterator<? extends Number> values) { checkArgument(values.hasNext(), "Cannot take mean of 0 values"); long count = 1; double mean = checkFinite(values.next().doubleValue()); while (values.hasNext()) { double value = checkFinite(values.next().doubleValue()); count++; // Art of Computer Programming vol. 2, Knuth, 4.2.2, (15) mean += (value - mean) / count; } return mean; }
/** * Returns the <a href="http://en.wikipedia.org/wiki/Arithmetic_mean">arithmetic mean</a> of * {@code values}. * * <p>If these values are a sample drawn from a population, this is also an unbiased estimator of * the arithmetic mean of the population. * * @param values a nonempty series of values * @throws IllegalArgumentException if {@code values} is empty or contains any non-finite value */ @GwtIncompatible("com.google.common.math.DoubleUtils") public static double mean(double... values) { checkArgument(values.length > 0, "Cannot take mean of 0 values"); long count = 1; double mean = checkFinite(values[0]); for (int index = 1; index < values.length; ++index) { checkFinite(values[index]); count++; // Art of Computer Programming vol. 2, Knuth, 4.2.2, (15) mean += (values[index] - mean) / count; } return mean; }
/** * Returns the <a href="http://en.wikipedia.org/wiki/Arithmetic_mean">arithmetic mean</a> of * {@code values}. * * <p>If these values are a sample drawn from a population, this is also an unbiased estimator of * the arithmetic mean of the population. * * @param values a nonempty series of values * @throws IllegalArgumentException if {@code values} is empty or contains any non-finite value * @deprecated Use {@link Stats#meanOf} instead, noting the less strict handling of non-finite * values. */ @Deprecated // com.google.common.math.DoubleUtils @GwtIncompatible public static double mean(double... values) { checkArgument(values.length > 0, "Cannot take mean of 0 values"); long count = 1; double mean = checkFinite(values[0]); for (int index = 1; index < values.length; ++index) { checkFinite(values[index]); count++; // Art of Computer Programming vol. 2, Knuth, 4.2.2, (15) mean += (values[index] - mean) / count; } return mean; }
/** * Returns the <a href="http://en.wikipedia.org/wiki/Arithmetic_mean">arithmetic mean</a> of * {@code values}. * * <p>If these values are a sample drawn from a population, this is also an unbiased estimator of * the arithmetic mean of the population. * * @param values a nonempty series of values * @throws IllegalArgumentException if {@code values} is empty or contains any non-finite value * @deprecated Use {@link Stats#meanOf} instead, noting the less strict handling of non-finite * values. */ @Deprecated // com.google.common.math.DoubleUtils @GwtIncompatible public static double mean(double... values) { checkArgument(values.length > 0, "Cannot take mean of 0 values"); long count = 1; double mean = checkFinite(values[0]); for (int index = 1; index < values.length; ++index) { checkFinite(values[index]); count++; // Art of Computer Programming vol. 2, Knuth, 4.2.2, (15) mean += (values[index] - mean) / count; } return mean; }
/** * Returns the <a href="http://en.wikipedia.org/wiki/Arithmetic_mean">arithmetic mean</a> of * {@code values}. * * <p>If these values are a sample drawn from a population, this is also an unbiased estimator of * the arithmetic mean of the population. * * @param values a nonempty series of values, which will be converted to {@code double} values * (this may cause loss of precision) * @throws IllegalArgumentException if {@code values} is empty or contains any non-finite value */ @GwtIncompatible("com.google.common.math.DoubleUtils") public static double mean(Iterator<? extends Number> values) { checkArgument(values.hasNext(), "Cannot take mean of 0 values"); long count = 1; double mean = checkFinite(values.next().doubleValue()); while (values.hasNext()) { double value = checkFinite(values.next().doubleValue()); count++; // Art of Computer Programming vol. 2, Knuth, 4.2.2, (15) mean += (value - mean) / count; } return mean; }
/** * Returns the <a href="http://en.wikipedia.org/wiki/Arithmetic_mean">arithmetic mean</a> of * {@code values}. * * <p>If these values are a sample drawn from a population, this is also an unbiased estimator of * the arithmetic mean of the population. * * @param values a nonempty series of values, which will be converted to {@code double} values * (this may cause loss of precision) * @throws IllegalArgumentException if {@code values} is empty or contains any non-finite value * @deprecated Use {@link Stats#meanOf} instead, noting the less strict handling of non-finite * values. */ @Deprecated // com.google.common.math.DoubleUtils @GwtIncompatible public static double mean(Iterator<? extends Number> values) { checkArgument(values.hasNext(), "Cannot take mean of 0 values"); long count = 1; double mean = checkFinite(values.next().doubleValue()); while (values.hasNext()) { double value = checkFinite(values.next().doubleValue()); count++; // Art of Computer Programming vol. 2, Knuth, 4.2.2, (15) mean += (value - mean) / count; } return mean; }
/** * Returns the <a href="http://en.wikipedia.org/wiki/Arithmetic_mean">arithmetic mean</a> of * {@code values}. * * <p>If these values are a sample drawn from a population, this is also an unbiased estimator of * the arithmetic mean of the population. * * @param values a nonempty series of values, which will be converted to {@code double} values * (this may cause loss of precision) * @throws IllegalArgumentException if {@code values} is empty or contains any non-finite value * @deprecated Use {@link Stats#meanOf} instead, noting the less strict handling of non-finite * values. */ @Deprecated // com.google.common.math.DoubleUtils @GwtIncompatible public static double mean(Iterator<? extends Number> values) { checkArgument(values.hasNext(), "Cannot take mean of 0 values"); long count = 1; double mean = checkFinite(values.next().doubleValue()); while (values.hasNext()) { double value = checkFinite(values.next().doubleValue()); count++; // Art of Computer Programming vol. 2, Knuth, 4.2.2, (15) mean += (value - mean) / count; } return mean; }