Here you can find the source of distanceMat(double[][] m1, double[][] m2)
public static double distanceMat(double[][] m1, double[][] m2)
//package com.java2s; /*//from w w w.j a v a 2 s. co m Copyright 2014, Xavier Hardy, Cl?ment Pique This file is part of ecm-classifier. ecm-classifier is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. ecm-classifier is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with ecm-classifier. If not, see <http://www.gnu.org/licenses/>. */ public class Main { public static double distanceMat(double[][] m1, double[][] m2) { double res2 = 0; for (int i = 0; i < m1.length; i++) { for (int j = 0; j < m1[i].length; j++) { res2 += (m1[i][j] - m2[i][j]) * (m1[i][j] - m2[i][j]); } } return Math.sqrt(res2); } }