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)
| 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 |
nothing calls this directly
no test coverage detected