Here you can find the source of subtract(double[][] a, double[][] b)
public static double[][] subtract(double[][] a, double[][] b)
//package com.java2s; //License from project: Open Source License public class Main { public static double[][] subtract(double[][] a, double[][] b) { double[][] d = new double[a.length][a[0].length]; if (isIdenticalMatrix(a, b)) { for (int i = 0; i < a.length; i++) { for (int j = 0; j < a[0].length; j++) { d[i][j] = a[i][j] - b[i][j]; }/* w ww. java 2s. com*/ } } else { } return d; } private static boolean isIdenticalMatrix(double[][] a, double[][] b) { if (a.length == b.length && a[0].length == b[0].length) { return true; } else { return false; } } }