code: public DenseMatrix getR() {
          int n = qr.ncols();
          DenseMatrix R = Matrix.zeros(n, n);
          for (int i = 0; i < n; i++) {
              R.set(i, i, tau[i]);
              for (int j = i+1; j < n; j++) {
                  R.set(i, j, qr.get(i, j));
              }
          }
          return R;
      }
docs: Returns the upper triangular factor.