(self, iszerofunc=_iszero, simplify=False)
return self._new(r), pivotlist
Return reduced row-echelon form of matrix and indices of pivot vars.

        To simplify elements before finding nonzero pivots set simplify=True
        (to use the default SymPy simplify function) or pass a custom
        simplify function.

        Examples
        ========

        >>> from sympy import Matrix
        >>> from sympy.abc import x
        >>> m = Matrix([[1, 2], [x, 1 - 1/x]])
        >>> m.rref()
        (Matrix([
        [1, 0],
        [0, 1]]), [0, 1])
Return reduced row-echelon form of matrix and indices of pivot vars.
Return reduced row - echelon form of matrix and indices of pivot vars .
def rref(self, iszerofunc=_iszero, simplify=False):
        """Return reduced row-echelon form of matrix and indices of pivot vars.

        To simplify elements before finding nonzero pivots set simplify=True
        (to use the default SymPy simplify function) or pass a custom
        simplify function.

        Examples
        ========

        >>> from sympy import Matrix
        >>> from sympy.abc import x
        >>> m = Matrix([[1, 2], [x, 1 - 1/x]])
        >>> m.rref()
        (Matrix([
        [1, 0],
        [0, 1]]), [0, 1])
        """
        simpfunc = simplify if isinstance(
            simplify, FunctionType) else _simplify
        # pivot: index of next row to contain a pivot
        pivot, r = 0, self.as_mutable()
        # pivotlist: indices of pivot variables (non-free)
        pivotlist = []
        for i in xrange(r.cols):
            if pivot == r.rows:
                break
            if simplify:
                r[pivot, i] = simpfunc(r[pivot, i])
            if iszerofunc(r[pivot, i]):
                for k in xrange(pivot, r.rows):
                    if simplify and k > pivot:
                        r[k, i] = simpfunc(r[k, i])
                    if not iszerofunc(r[k, i]):
                        r.row_swap(pivot, k)
                        break
                else:
                    continue
            scale = r[pivot, i]
            r.row_op(pivot, lambda x, _: x / scale)
            for j in xrange(r.rows):
                if j == pivot:
                    continue
                scale = r[j, i]
                r.zip_row_op(j, pivot, lambda x, y: x - scale*y)
            pivotlist.append(i)
            pivot += 1
        return self._new(r), pivotlist
def rref ( self , iszerofunc = _iszero , simplify = False ) : simpfunc = simplify if isinstance ( simplify , FunctionType ) else _simplify # pivot: index of next row to contain a pivot pivot , r = 0 , self . as_mutable ( ) # pivotlist: indices of pivot variables (non-free) pivotlist = [ ] for i in xrange ( r . cols ) : if pivot == r . rows : break if simplify : r [ pivot , i ] = simpfunc ( r [ pivot , i ] ) if iszerofunc ( r [ pivot , i ] ) : for k in xrange ( pivot , r . rows ) : if simplify and k > pivot : r [ k , i ] = simpfunc ( r [ k , i ] ) if not iszerofunc ( r [ k , i ] ) : r . row_swap ( pivot , k ) break else : continue scale = r [ pivot , i ] r . row_op ( pivot , lambda x , _ : x / scale ) for j in xrange ( r . rows ) : if j == pivot : continue scale = r [ j , i ] r . zip_row_op ( j , pivot , lambda x , y : x - scale * y ) pivotlist . append ( i ) pivot += 1 return self . _new ( r ) , pivotlist