[SciPy-user] RREF - upper triangular

Nils Wagner nwagner at mecha.uni-stuttgart.de
Wed Feb 22 02:36:04 CST 2006

Robert Kern wrote:
>Ryan Krauss wrote:
>>Is there a scipy function to find the upper triangular form of a
>>matrix?  I need to find the null space or null spaces of a matrix and
>>have messed around with SVD in the past, but it seems like doing row
>>reduction on something like [A]x=[0] has worked well.  I have written
>>my own RREF algorithm in Python, but it seems like I have re-invented
>>the wheel and I would prefer to use something someone else already
>>wrote who is smarter about round-off error and I would also prefer
>>something in FORTRAN of C for speed.  It seems like linalg.solve
>>almost does what I want except I would need it to return the matrix I
>>assume it is calculating instead of or along with the solution.
>Well, there's rank-revealing QR, which does essentially what you want. The
>appropriate LAPACK functions are xGEQP3. It is not currently wrapped in
>scipy.linalg, but it should be fairly easy to add.

Please, can you integrate it in scipy - it is still on my wishlist ;-)
linalg.rrqr sounds good to me.


>The LU and (regular) QR decompositions won't help you because they don't do any
>ordering to demonstrate the rank. RRQR will order R, the upper-triangular
>matrix, such that R[rank(A):,:] are all 0.


More information about the SciPy-user mailing list