[SciPy-user] Matlab's economy QR

Rick Muller rmuller at sandia.gov
Fri Oct 21 06:15:51 CDT 2005


Yup. That worked. Thanks very much.

On Oct 20, 2005, at 11:11 PM, Travis Oliphant wrote:

>> I'm trying to mimic matlabs "economy size" qr decomposition in scipy.
>> Does anyone know how to achieve this using scipy.linalg.qr?
>>
>> If I call
>>     q,r = qr(A)
>> Can I then do something like say
>>       q = q[:A.shape[0]]
>> or something along these lines?
>>
>>
>>
> Yes, something like that.  Presumably you are after the just the  
> columns
> of q corresponding to the non-zero rows of r.
>
> In that case (assuming m>n)
>
> m,n = A.shape
> q,r = qr(A)
> qhat = q[:,:n]
> rhat = r[:n]
>
> should work.
>




More information about the SciPy-user mailing list