Computational Science Stack Exchange is a question and answer site for scientists using computers to solve scientific problems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have an mathematical theorem on the QR decomposition, which relies on the QR decomposition of an invertible square complex matrix always constructing a triangular matrix with real diagonal entries.

While at least in Octave this seems to be true, I wonder this can be relied upon in practice. I am looking for an implementation that does not produce such a triangular factor.

PS: Actually the theorem in question is the correctness of the double shifted QR iteration, as described in section 3.5 of . The presentation seems to rely on a particular implementation of the QR algorithm.

share|improve this question

A slight generalization of a Householder reflector, as seen in LAPACK's zlarfg, can be used to define a sequence of unitary transformations. In particular, the $j$'th transformation zeros the portion of the matrix below the $j$'th diagonal entry, and also ensures that the $j$'th diagonal entry becomes real. The unblocked algorithm zgeqr2 and the blocked algorithm zgeqrf make use of this approach.

On the other hand, suppose that you have an algorithm that provides $A=QR$, where $R$ is triangular but with complex diagonal entries. Then define the diagonal matrix $\Omega$ to have diagonal entries drawn from the unit circle such that $\Omega R$ has real diagonal entries, which would imply that the decomposition $A=(Q \bar \Omega)(\Omega R)$ is a QR decomposition with your desired properties.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.