Example #1
0
 // Clone a Matrix
 public Object clone() {
   if (this == null) {
     return null;
   } else {
     int nr = this.nrow;
     int nc = this.ncol;
     MatrixError b = new MatrixError(nr, nc);
     double[][] barray = b.getArrayReference();
     b.nrow = nr;
     b.ncol = nc;
     for (int i = 0; i < nr; i++) {
       for (int j = 0; j < nc; j++) {
         barray[i][j] = this.matrix[i][j];
       }
     }
     for (int i = 0; i < nr; i++) b.index[i] = this.index[i];
     return (Object) b;
   }
 }
Example #2
0
 // COPY
 // Copy a Matrix [static method]
 public static MatrixError copy(MatrixError a) {
   if (a == null) {
     return null;
   } else {
     int nr = a.getNrow();
     int nc = a.getNcol();
     double[][] aarray = a.getArrayReference();
     MatrixError b = new MatrixError(nr, nc);
     b.nrow = nr;
     b.ncol = nc;
     double[][] barray = b.getArrayReference();
     for (int i = 0; i < nr; i++) {
       for (int j = 0; j < nc; j++) {
         barray[i][j] = aarray[i][j];
       }
     }
     for (int i = 0; i < nr; i++) b.index[i] = a.index[i];
     return b;
   }
 }