Java mean mean(double[][] matrix)

Here you can find the source of mean(double[][] matrix)

Description

Computes avarage value from all entries in the matrix

License

Open Source License

Parameter

Parameter Description
matrix the matrix

Return

avarage value from all entries in the matrix

Declaration

public static double mean(double[][] matrix) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    /**/* w  ww .j a va 2s . co m*/
     * Computes avarage value from all entries in the matrix
     * @param matrix the matrix
     * @return avarage value from all entries in the matrix
     */
    public static double mean(double[][] 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);
    }
}

Related

  1. mean(double[] values)
  2. mean(double[] vector)
  3. mean(double[] x, boolean[] used)
  4. mean(double[][] image)
  5. mean(double[][] input, int column)
  6. mean(double[][] o)
  7. mean(final double[] a)
  8. mean(final double[] data, final boolean noNaN)
  9. mean(final double[] expected, final int begin, final int end)