[SciPy-user] Rank-Revealing QR factorization of dense matrices in scipy

Nils Wagner nwagner at mecha.uni-stuttgart.de
Tue Oct 12 09:31:29 CDT 2004

Robert Kern wrote:

> Nils Wagner wrote:
>> Hi all,
>> Has someone written a function for Rank-Revealing QR factorization of 
>> dense matrices in scipy ?
> No. The relevant LAPACK function set is xGEQP3, I believe. 
> Contributions are welcome.
BTW, a good source is

C. H. Bischof, G. Quintana-Orti
Algorithm 782: Codes for Rank-Revealing QR Factorizations of Dense

ACM Transactions on Mathematical software, Vol.24 No. 2 pp. 254-257

>> Is there a function to determine the numerical rank of a matrix in 
>> scipy ?
> Tip: grep the source before asking here.
> Offhand, I don't see one standing alone.
> If your arrays aren't too large, you can use linalg.svdvals to compute 
> the singular values. The number of values greater than the largest 
> value times machine epsilon is a good estimate of the rank.
> Alternatively, the rank* of A can be computed by linalg.lstsq(A, 
> ones(A.shape[0]))[2].
> * It's documented as the "effective rank." I think we're talking about 
> the same thing, though.
It would be nice to have a built-in function (e.g. rank(A)) for this 
Maybe linalg.orth can be used in this context.



More information about the SciPy-user mailing list