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

Virgil Stokes vs at it.uu.se
Wed Nov 21 03:34:29 EST 2012


On 21-Nov-2012 03:47, Alejandro Weinstein wrote:
> On Tue, Nov 20, 2012 at 5:56 PM, Virgil Stokes <vs at it.uu.se> wrote:
>> On 2012-11-21 01:48, Alejandro Weinstein wrote:
>>> On Tue, Nov 20, 2012 at 5:36 PM, Virgil Stokes <vs at it.uu.se> wrote:
>>>> which is clearly not PD, since the it's 3 eigenvalues (diagonal
>>>> elements) are all negative.
>>> But why you expect R to be PD?
>> Because    R*R^T = P (a covariance matrix). One important reason for
>> using the QR factorization in the KF is to ensure that R is always PD
>> during the recursions.
> As you said, P = R * R^T, which is PD, even if R is not. Please check
> the definition of QR decomposition: R is _not_ required to be PD.
Yes, again Alejandro I know this --- my statement was really not correct (sloppy 
on my part).
>
> Looking at the paper, they in fact use P = R * R ^ T, as in eq. (1).
> They never use R alone. So the fact that R is not PD should not be an
> issue.
But, again, it is an issue for the algorithm given in Table 3 (p. 2248 of 
paper).  Look at step 8. and equation (30). As stated in this step "The 
square-root of the filtered state-error covariance" is returned as $T_{22}$ from 
step 5. where a QR decomposition is performed for the triangularization. The 
$S_{k+1|k+1}$ matrix must have diagonal elements > 0  (I leave this to you to 
think about). When I perform step 5. with MATLAB, I *always* get a $T_{22}$ that 
has diagonal elements > 0 for my application (which is satisfying). When I 
perform step 5. with numpy, for the same matrix on the RHS of (27) I *do not 
always* get diagonal elements > 0  for $T_{22}$ --- herein lies the problem that 
I have been trying to explain.
> Can you show your code? I'm curious to see how the fact that R
> is not PD makes a difference.
You should be able to write a few lines of code to test this yourself. If this 
problem does not occur on your system then please tell me what version of 
Scipy/numpy you have installed and on what platform.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.scipy.org/pipermail/scipy-user/attachments/20121121/c09d77ef/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tblatex-1.png
Type: image/png
Size: 721 bytes
Desc: not available
URL: <http://mail.scipy.org/pipermail/scipy-user/attachments/20121121/c09d77ef/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tblatex-2.png
Type: image/png
Size: 907 bytes
Desc: not available
URL: <http://mail.scipy.org/pipermail/scipy-user/attachments/20121121/c09d77ef/attachment-0001.png>


More information about the SciPy-User mailing list