code: public function getQ()
      {
          for ($k = $this->n - 1; $k >= 0; --$k) {
              for ($i = 0; $i < $this->m; ++$i) {
                  $Q[$i][$k] = 0.0;
              }
              $Q[$k][$k] = 1.0;
              for ($j = $k; $j < $this->n; ++$j) {
                  if ($this->QR[$k][$k] != 0) {
                      $s = 0.0;
                      for ($i = $k; $i < $this->m; ++$i) {
                          $s += $this->QR[$i][$k] * $Q[$i][$j];
                      }
                      $s = -$s / $this->QR[$k][$k];
                      for ($i = $k; $i < $this->m; ++$i) {
                          $Q[$i][$j] += $s * $this->QR[$i][$k];
                      }
                  }
              }
          }
  
          return new Matrix($Q);
      }
docs: Generate and return the (economy-sized) orthogonal factor.
  
  @return Matrix orthogonal factor