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

Robert Kern rkern at ucsd.edu
Tue Oct 12 09:54:09 EDT 2004


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.

> 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.

-- 
Robert Kern
rkern at ucsd.edu

"In the fields of hell where the grass grows high
  Are the graves of dreams allowed to die."
   -- Richard Harter




More information about the SciPy-User mailing list