Here you can find the source of mean(double[][] matrix)
Parameter | Description |
---|---|
matrix | the matrix |
public static double mean(double[][] matrix)
//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); } }