[SciPy-user] Matlab to numpy
bart.vandereycken at cs.kuleuven.be
Fri Jun 23 08:10:05 CDT 2006
Nils Wagner wrote:
> The economy size decomposition means that if A is an m \ŧimes n matrix
> with m > n then only the first n columns of Q are computed.
> linalg.qr computes a full QR decomposition.
I also use Matlab's economy-size QR method quite often. So I ended up
writing my own python-wrapper.
The qr-method in scipy really needs more functionality.
You can basically ask 3 things from a QR method:
1) The upper triangular matrix R
R = qr(A)
2) R and the unitary matrix Q
Q,R = qr(A)
3) R, Q and a permutation vector E, such that abs(diag(R)) is decreasing.
Q,R,E = qr(A)
For all those methods, an economy-size version should be written.
I don't think this will demand much time, because method 2 is already
available. For Matlab-users it would be convenient to use the Matlab
notation (like above), but IMO the economy flag qr(A,0) is not transparent.
For method 1) you just call xGEQRF and not xORGQR. An economy version is
also easy. I adjusted the wrapper of decompy.py to a method decomp.qr_r
(you can find it in the attachment).
Method 2) needs an economy version. This means that you don't construct
the whole matrix Q in the call xORGQR but only the first N columns.
Method 3) needs a new wrapper to xGEQP3. This is useful when A is not of
Maybe I'll try to implement this in the next days or so.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 2223 bytes
Desc: not available
Url : http://www.scipy.net/pipermail/scipy-user/attachments/20060623/e71fbd6c/decomp_qr.py
More information about the SciPy-user