(self, rhs, iszerofunc=_iszero)
return rhs.__class__(b)
Solve the linear system Ax = rhs for x where A = self.

        This is for symbolic matrices, for real or complex ones use
        sympy.mpmath.lu_solve or sympy.mpmath.qr_solve.

        See Also
        ========

        lower_triangular_solve
        upper_triangular_solve
        cholesky_solve
        diagonal_solve
        LDLsolve
        QRsolve
        pinv_solve
        LUdecomposition
Solve the linear system Ax = rhs for x where A = self.
Solve the linear system Ax = rhs for x where A = self .
def LUsolve(self, rhs, iszerofunc=_iszero):
        """Solve the linear system Ax = rhs for x where A = self.

        This is for symbolic matrices, for real or complex ones use
        sympy.mpmath.lu_solve or sympy.mpmath.qr_solve.

        See Also
        ========

        lower_triangular_solve
        upper_triangular_solve
        cholesky_solve
        diagonal_solve
        LDLsolve
        QRsolve
        pinv_solve
        LUdecomposition
        """
        if rhs.rows != self.rows:
            raise ShapeError("`self` and `rhs` must have the same number of rows.")

        A, perm = self.LUdecomposition_Simple(iszerofunc=_iszero)
        n = self.rows
        b = rhs.permuteFwd(perm).as_mutable()
        # forward substitution, all diag entries are scaled to 1
        for i in xrange(n):
            for j in xrange(i):
                scale = A[i, j]
                b.zip_row_op(i, j, lambda x, y: x - y*scale)
        # backward substitution
        for i in xrange(n - 1, -1, -1):
            for j in xrange(i + 1, n):
                scale = A[i, j]
                b.zip_row_op(i, j, lambda x, y: x - y*scale)
            scale = A[i, i]
            b.row_op(i, lambda x, _: x/scale)
        return rhs.__class__(b)
def LUsolve ( self , rhs , iszerofunc = _iszero ) : if rhs . rows != self . rows : raise ShapeError ( "`self` and `rhs` must have the same number of rows." ) A , perm = self . LUdecomposition_Simple ( iszerofunc = _iszero ) n = self . rows b = rhs . permuteFwd ( perm ) . as_mutable ( ) # forward substitution, all diag entries are scaled to 1 for i in xrange ( n ) : for j in xrange ( i ) : scale = A [ i , j ] b . zip_row_op ( i , j , lambda x , y : x - y * scale ) # backward substitution for i in xrange ( n - 1 , - 1 , - 1 ) : for j in xrange ( i + 1 , n ) : scale = A [ i , j ] b . zip_row_op ( i , j , lambda x , y : x - y * scale ) scale = A [ i , i ] b . row_op ( i , lambda x , _ : x / scale ) return rhs . __class__ ( b )