[SciPy-User] qr decompostion gives negative q, r ?

Alejandro Weinstein alejandro.weinstein@gmail....
Tue Nov 20 18:48:35 CST 2012


On Tue, Nov 20, 2012 at 5:36 PM, Virgil Stokes <vs@it.uu.se> wrote:
> Using np.linalg.qr(A) I get the following for R (3x3) which is
> "square-root" of the covariance matrix:
>
> array([[ -1.00124922e+03,   4.99289918e+00,   0.00000000e+00],
>         [  0.00000000e+00,  -1.00033071e+02,   5.62045938e-04],
>         [  0.00000000e+00,   0.00000000e+00,  -9.98419272e-03]])
>
> which is clearly not PD, since the it's 3 eigenvalues (diagonal
> elements) are all negative.

But why you expect R to be PD? The QR decomposition [1] is

A = QR with Q^T Q = I and R upper diagonal.

[1] http://en.wikipedia.org/wiki/QR_factorization


More information about the SciPy-User mailing list