public static Matrix constructWithCopy(double[][] A){
  int m=A.length;
  int n=A[0].length;
  Matrix X=new Matrix(m,n);
  double[][] C=X.getArray();
  for (int i=0; i < m; i++) {
    if (A[i].length != n) {
      throw new IllegalArgumentException("All rows must have the same length.");
    }
    for (int j=0; j < n; j++) {
      C[i][j]=A[i][j];
    }
  }
  return X;
}

public static Matrix constructWithCopy ( double [ ] [ ] A ) { int m = A . length ; int n = A [ 0 ] . length ; Matrix X = new Matrix ( m , n ) ; double [ ] [ ] C = X . getArray ( ) ; for ( int i = 0 ; i < m ; i ++ ) { if ( A [ i ] . length != n ) { throw new IllegalArgumentException ( "All rows must have the same length." ) ; } for ( int j = 0 ; j < n ; j ++ ) { C [ i ] [ j ] = A [ i ] [ j ] ; } } return X ; }
construct a matrix from a copy of a 2 - d array .
