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 http://people.inf.ethz.ch/arbenz/ewp/Lnotes/chapter3.pdf . The presentation seems to rely on a particular implementation of the QR algorithm.


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.

| cite | improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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