(ctx, A, x, b, **kwargs)
Calculate the residual of a solution to a linear equation system.

        r = A*x - b for A*x = b
Calculate the residual of a solution to a linear equation system.
Calculate the residual of a solution to a linear equation system .
def residual(ctx, A, x, b, **kwargs):
        """
        Calculate the residual of a solution to a linear equation system.

        r = A*x - b for A*x = b
        """
        oldprec = ctx.prec
        try:
            ctx.prec *= 2
            A, x, b = ctx.matrix(A, **kwargs), ctx.matrix(x, **kwargs), ctx.matrix(b, **kwargs)
            return A*x - b
        finally:
            ctx.prec = oldprec
def residual ( ctx , A , x , b , * * kwargs ) : oldprec = ctx . prec try : ctx . prec *= 2 A , x , b = ctx . matrix ( A , * * kwargs ) , ctx . matrix ( x , * * kwargs ) , ctx . matrix ( b , * * kwargs ) return A * x - b finally : ctx . prec = oldprec