MCPcopy Create free account
hub / github.com/antlr/codebuff / mean

Method mean

output/java_guava/1.4.17/DoubleMath.java:404–418  ·  view source on GitHub ↗

Returns the arithmetic mean of values. 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 IllegalA

(double... values)

Source from the content-addressed store, hash-verified

402 */
403
404 @Deprecated
405 // com.google.common.math.DoubleUtils
406 @GwtIncompatible
407 public static double mean(double... values) {
408 checkArgument(values.length > 0, "Cannot take mean of 0 values");
409 long count = 1;
410 double mean = checkFinite(values[0]);
411 for (int index = 1; index < values.length; ++index) {
412 checkFinite(values[index]);
413 count++;
414 // Art of Computer Programming vol. 2, Knuth, 4.2.2, (15)
415 mean += (values[index] - mean) / count;
416 }
417 return mean;
418 }
419
420 /**
421 * Returns the <a href="http://en.wikipedia.org/wiki/Arithmetic_mean">arithmetic mean</a> of

Callers

nothing calls this directly

Calls 6

checkFiniteMethod · 0.95
iteratorMethod · 0.65
nextMethod · 0.65
checkArgumentMethod · 0.45
hasNextMethod · 0.45
doubleValueMethod · 0.45

Tested by

no test coverage detected