Here you can find the source of matrixAbsDiff(double m1[][], double m2[][])
public static double matrixAbsDiff(double m1[][], double m2[][])
//package com.java2s; //License from project: Open Source License public class Main { public static double matrixAbsDiff(double m1[][], double m2[][]) { if (m1.length != m2.length) return Double.MAX_VALUE; int numElements = 0; double diff = 0.0; for (int i = 0; i < m1.length; i++) { if (m1[i].length != m2[i].length) return Double.MAX_VALUE; numElements += m1[i].length; for (int j = 0; j < m1[i].length; j++) { diff += Math.abs(m1[i][j] - m2[i][j]); }/*from w ww.j a v a 2 s . c o m*/ } if (numElements == 0) return 0.0; return diff / numElements; } }