code: public static void convert(SquareMatrix sm)
      {
          for (int r = 0; r < sm.nRows; ++r) {
              for (int c = 0; c < sm.nCols; ++c) {
                  sm.values[r][c] = (r == c) ? 1 : 0;
              }
          }
      }
docs: Convert a square matrix into an identity matrix.
  @param sm the square matrix to convert