docs: public void decompose( DMatrixRMaj A ) {
  
          this.QR = A.copy();
  
          int N = Math.min(A.numCols,A.numRows);
  
          gammas = new double[ A.numCols ];
  
          DMatrixRMaj A_small = new DMatrixRMaj(A.numRows,A.numCols);
          DMatrixRMaj A_mod = new DMatrixRMaj(A.numRows,A.numCols);
          DMatrixRMaj v = new DMatrixRMaj(A.numRows,1);
          DMatrixRMaj Q_k = new DMatrixRMaj(A.numRows,A.numRows);
  
          for( int i = 0; i < N; i++ ) {
              // reshape temporary variables
              A_small.reshape(QR.numRows-i,QR.numCols-i);
              v.reshape(A_small.numRows,1);
              Q_k.reshape(v.getNumElements(),v.getNumElements());
  
              // use extract matrix to get the column that is to be zeroed
              CommonOps_DDRM.extract(QR,i,QR.numRows,i,i+1,v,0,0);
  
              double max = CommonOps_DDRM.elementMaxAbs(v);
  
              if( max > 0 && v.getNumElements() > 1 ) {
                  // normalize to reduce overflow issues
                  CommonOps_DDRM.divide(v,max);
  
                  // compute the magnitude of the vector
                  double tau = NormOps_DDRM.normF(v);
  
                  if( v.get(0) < 0 )
                      tau *= -1.0;
  
                  double u_0 = v.get(0) + tau;
                  double gamma = u_0/tau;
  
                  CommonOps_DDRM.divide(v,u_0);
                  v.set(0,1.0);
  
                  // extract the submatrix of A which is being operated on
                  CommonOps_DDRM.extract(QR,i,QR.numRows,i,QR.numCols,A_small,0,0);
  
                  // A = (I - &gamma;*u*u<sup>T</sup>)A
                  CommonOps_DDRM.setIdentity(Q_k);
                  CommonOps_DDRM.multAddTransB(-gamma,v,v,Q_k);
                  CommonOps_DDRM.mult(Q_k,A_small,A_mod);
  
                  // save the results
                  CommonOps_DDRM.insert(A_mod, QR, i,i);
                  CommonOps_DDRM.insert(v, QR, i,i);
                  QR.unsafe_set(i,i,-tau*max);
  
                  // save gamma for recomputing Q later on
                  gammas[i] = gamma;
              }
          }
      }