Update tellurium.py
Added rref (reduced row echelon). Uses sympy to do the calculation but takes a numpy array.
@@ -1043,6 +1043,18 @@ def nullspace(A, atol=1e-13, rtol=0):
ns = vh[nnz:].conj().T
return ns
+
+# We import sympy here because it is slow to load and would slow down the initial
+# start up of tellurium
+def rref (A):
+ """Compute the reduced row echelon for the matrix A. Returns
+ returns a tuple of two elements. The first is the reduced row
+ echelon form, and the second is a list of indices of the pivot columns.
+ """
+ import sympy
+ m = sympy.Matrix (A)
+ return m.rref()
+
# ---------------------------------------------------------------
# End of routines
# ---------------------------------------------------------------
