List of utility methods to do mean
double[] | mean(double[][] o) mean int rows = o.length; int cols = o[0].length; double[] result = new double[cols]; for (double[] row : o) { assert (row.length == cols); for (int i = 0; i < cols; ++i) { result[i] += row[i]; for (int i = 0; i < cols; ++i) { result[i] /= (double) rows; return result; |
double | mean(final double[] a) Calculate the mean of the vector, NaN if it's empty return mean(a, sum(a));
|
double | mean(final double[] data, final boolean noNaN) Calc the mean of an array of double return mean(noNaN ? removeNaN(data) : data);
|
double | mean(final double[] expected, final int begin, final int end) mean int trueN = 0; double mean = 0d; for (int i = Math.max(0, begin); i < Math.min(expected.length - 1, end); i++) { mean += expected[i]; trueN++; if (trueN == 0) throw new IllegalStateException(); ... |
double | mean(final double[] in, final int start, final int stop) Calculate the mean of an array of doubles. if ((stop - start) <= 0) return Double.NaN; double total = 0; for (int i = start; i < stop; ++i) { total += in[i]; return total / (stop - start); |
double | mean(final double[] values) mean return sum(values) / values.length;
|
double | mean(final double[] vec) Computes the mean of the elements of a vector. assert vec != null; return sum(vec) / vec.length; |
float | mean(final int[] scores) mean if (scores.length == 0) { return -1f; long total = 0L; for (int s : scores) { total += s; return total / scores.length; ... |
double | mean(final int[] values) Get the mean of an array of integers. if (values == null) { throw new IllegalArgumentException("input value array is null"); final int len = values.length; int sum = 0; for (int value : values) { sum += value; return (double) sum / len; |
float | mean(float a, float b) mean return (a + b) * 0.5f;
|