code: public DMatrixRMaj getQ() {
          DMatrixRMaj Q = CommonOps_DDRM.identity(QR.numRows);
          DMatrixRMaj Q_k = new DMatrixRMaj(QR.numRows,QR.numRows);
          DMatrixRMaj u = new DMatrixRMaj(QR.numRows,1);
  
          DMatrixRMaj temp = new DMatrixRMaj(1,1);
  
          int N = Math.min(QR.numCols,QR.numRows);
  
          // compute Q by first extracting the householder vectors from the columns of QR and then applying it to Q
          for( int j = N-1; j>= 0; j-- ) {
              CommonOps_DDRM.extract(QR,j, QR.numRows,j,j+1,u,j,0);
              u.set(j,1.0);
  
              // A = (I - &gamma;*u*u<sup>T</sup>)*A<br>
              CommonOps_DDRM.setIdentity(Q_k);
              CommonOps_DDRM.multAddTransB(-gammas[j],u,u,Q_k);
              CommonOps_DDRM.mult(Q_k,Q,temp);
              Q.set(temp);
          }
  
          return Q;
      }
docs: Returns the Q matrix.