X-Git-Url: https://svn.cri.ensmp.fr/git/linpy.git/blobdiff_plain/b046bdcc9044a88743a98bb06951f917edafae59..5b661514c1bbabd8205fdbd22a0ba0f6b1ac6305:/pypol/polyhedra.py 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)