[Numpy-discussion] Reduced row echelon form

Stéfan van der Walt stefan@sun.ac...
Wed Nov 19 04:14:55 CST 2008

Hi Robert,

2008/11/18 Robert Young <rob@roryoung.co.uk>:
> Is there a method in NumPy that reduces a matrix to it's reduced row echelon
> form? I'm brand new to both NumPy and linear algebra, and I'm not quite sure
> where to look.

I use the Sympy package.  It is small, easy to install, runs on pure
Python, and gets the job done:

>>> x = np.random.random((3,3))
>>> import sympy
>>> sympy.Matrix(x).rref()
([1, 0, 0]
[0, 1, 0]
[0, 0, 1], [0, 1, 2])

If you are interested, I can also provide you with a version that runs
under pure NumPy, using the LU-decomposition.


More information about the Numpy-discussion mailing list