[SciPy-user] Matlab's economy size QR decomposition
Travis Oliphant
oliphant at ee.byu.edu
Fri Oct 21 01:20:44 EDT 2005
Rick Muller 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.
-Travis O.
More information about the SciPy-User
mailing list