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

Virgil Stokes vs@it.uu...
Mon Nov 19 17:01:38 CST 2012


I am using the latest versions of numpy (from 
numpy-1.7.0b2-win32-superpack-python2.7.exe) and scipy (from 
scipy-0.11.0-win32-superpack-python2.7.exe ) on a windows 7 (32-bit) 
platform.

I have used

import numpy as np
q,r = np.linalg.qr(A)

and compared the results to what I get from MATLAB (R2010B)

[q,r] = qr(A)

The q,r returned from numpy are both the negative of the q,r returned 
from MATLAB for the same matrix A. I believe that theq,r returned from 
MATLAB are correct. Why am I getting their negative from numpy?

Note, I have tried this on several different matrices ---  numpy always 
gives the negative of MATLAB's.



More information about the SciPy-User mailing list