[SciPy-User] Question about Scipy tutorial relating QR decomposition and SVD

Robert Kern robert.kern at gmail.com
Mon Jun 10 11:09:47 EDT 2013


On Mon, Jun 10, 2013 at 3:56 PM, Ahmed Fasih <wuzzyview at gmail.com> wrote:
> In the Scipy tutorial's discussion of linear algebra, specifically the
> QR decomposition [1], the claim is made that the QR decomposition can
> be found via the SVD, i.e., rather than doing
>
>>> Q, R = scipy.linalg.qr(A)
>
> one may use the SVD to get a QR decomposition:
>
>>> U, S, Vh = scipy.linalg.svd(A)
>>> Q2 = U
>>> R2 = numpy.dot(numpy.diag(S), Vh)
>
> However, having just tried this for a random square matrix `A`, I can
> verify that `R2` above is not upper-triangular, and (Q2, R2) isn't
> quite a QR decomposition. Should the tutorial be updated to excise
> this from its discussion, or am I doing something wrong?

The tutorial is wrong. The SVD and the QR decomposition do not have
that relationship.

--
Robert Kern



More information about the SciPy-User mailing list