X-Git-Url: https://svn.cri.ensmp.fr/git/linpy.git/blobdiff_plain/2bad3743bd25bbcfe12db50e2b18ab8d070f2354..7c6b2612e47086563cd58ae57c13a7a1beca03b8:/pypol/polyhedra.py?ds=inline diff --git a/pypol/polyhedra.py b/pypol/polyhedra.py index e745d7d..6b5f9ab 100644 --- a/pypol/polyhedra.py +++ b/pypol/polyhedra.py @@ -182,14 +182,27 @@ class Polyhedron(Domain): else: strings = [] for equality in self.equalities: - strings.append('0 == {}'.format(equality)) + strings.append('Eq({}, 0)'.format(equality)) for inequality in self.inequalities: - strings.append('0 <= {}'.format(inequality)) + strings.append('Ge({}, 0)'.format(inequality)) if len(strings) == 1: return strings[0] else: return 'And({})'.format(', '.join(strings)) + def _repr_latex_(self): + if self.isempty(): + return '$\\emptyset$' + elif self.isuniverse(): + return '$\\Omega$' + else: + strings = [] + for equality in self.equalities: + strings.append('{} = 0'.format(equality._repr_latex_().strip('$'))) + for inequality in self.inequalities: + strings.append('{} \\ge 0'.format(inequality._repr_latex_().strip('$'))) + return '${}$'.format(' \\wedge '.join(strings)) + @classmethod def fromsympy(cls, expr): domain = Domain.fromsympy(expr)