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

Virgil Stokes vs at it.uu.se
Tue Nov 20 18:21:00 EST 2012


On 2012-11-20 23:59, Robert Kern wrote:
> On Tue, Nov 20, 2012 at 10:49 PM, Virgil Stokes <vs at it.uu.se> wrote:
>
>> Ok Skipper,
>> Unfortunately, things are worse than I had hoped, numpy sometimes
>> returns the negative of the q,r and other times the same as MATLAB!
>> Thus, as someone has already mentioned in this discussion, the "sign"
>> seems to depend on the matrix being decomposed. This could be a
>> nightmare to track down.
>>
>> I hope that I can return to some older versions of numpy/scipy to work
>> around this problem until this problem is fixed. Any suggestions on how
>> to recover earlier versions would be appreciated.
> That's not going to help you. The only thing that we guarantee (or
> have *ever* guaranteed) is that the result is a valid QR
> decomposition. If you need to swap signs to normalize things to your
> desired convention, you will need to do that as a postprocessing step.
But why do I need to normalize with numpy (at least with latest 
release); but not with MATLAB.

A simple question for you.

In my application MATLAB generates a sequence of QR factorizations for 
covariance matrices in which R is always PD --- which is corect! For the 
same application, numpy generate a sequence of QR factorizations for 
covariance matrices in which R is not always PD.

How can I predict when  I will get an R that is not PD?
>
> --
> Robert Kern
> _______________________________________________
> SciPy-User mailing list
> SciPy-User at scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-user




More information about the SciPy-User mailing list