public static boolean equal(double[][] a,double[][] b){
  if (a == null) {
    return (b == null);
  }
  if (b == null) {
    return false;
  }
  if (a.length != b.length) {
    return false;
  }
  for (int i=0; i < a.length; i++) {
    if (!Arrays.equals(a[i],b[i])) {
      return false;
    }
  }
  return true;
}

public static boolean equal ( double [ ] [ ] a , double [ ] [ ] b ) { if ( a == null ) { return ( b == null ) ; } if ( b == null ) { return false ; } if ( a . length != b . length ) { return false ; } for ( int i = 0 ; i < a . length ; i ++ ) { if ( ! Arrays . equals ( a [ i ] , b [ i ] ) ) { return false ; } } return true ; }
tests two arrays for equality . to be considered equal , the arrays must have exactly the same dimensions , and the values in each array must also match ( two values that qre both nan or both inf are considered equal in this test ) .
