Java Utililty Methods mean

List of utility methods to do mean

Description

The list of methods to do mean are organized into topic(s).

Method

doublemean(double[] nums)
mean
double s = 0;
for (double n : nums) {
    s += n;
return s / nums.length;
doublemean(double[] samples)
mean
return mean(samples, 0, samples.length);
doublemean(double[] series)
Computes the mean value of timeseries.
double res = 0D;
int count = 0;
for (double tp : series) {
    if (Double.isNaN(tp) || Double.isInfinite(tp)) {
    } else {
        res += tp;
        count += 1;
if (count > 0) {
    return res / ((Integer) count).doubleValue();
return Double.NaN;
doublemean(double[] v)
Computes the mean.
if (v.length == 0)
    throw new IllegalArgumentException("Nothing to compute! The array must have at least one element.");
return (mass(v) / (double) v.length);
doublemean(double[] values)
Computes the mean of the values in the given array.
return sum(values) / values.length;
doublemean(double[] vector)
Returns the mean of the vector.
return sum(vector) / vector.length;
doublemean(double[] x, boolean[] used)
mean
int size = x.length;
double sum = 0d;
int n = 0;
for (int i = 0; i < size; i++) {
    if (used[i]) {
        sum += x[i];
        n++;
return sum / (double) n;
doublemean(double[][] image)
mean
return 0;
doublemean(double[][] input, int column)
Compute the mean along the given column
return sum(input, column) / (double) input.length;
doublemean(double[][] matrix)
Computes avarage value from all entries in the matrix
double m = 0;
for (int i = 0; i < matrix.length; i++) {
    for (int j = 0; j < matrix[0].length; j++) {
        m += matrix[i][j];
return m / (matrix.length * matrix[0].length);