code: public void duplicate(IMatrix result) {
          if ((result.rows != rows) || (result.columns != columns)) result.reshape(rows, columns);
  
          int i, j;
          for (i = 0; i < rows; i++)
              for (j = 0; j < columns; j++) {
                  result.realmatrix[i][j] = realmatrix[i][j];
                  result.imagmatrix[i][j] = imagmatrix[i][j];
              }
      }
docs: Copy a matrix