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

Ahmed Fasih wuzzyview at gmail.com
Mon Jun 10 10:56:03 EDT 2013


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?

Thanks,
Ahmed

[1] http://docs.scipy.org/doc/scipy/reference/tutorial/linalg.html#qr-decomposition



More information about the SciPy-User mailing list