X-Git-Url: https://scm.cri.mines-paristech.fr/git/linpy.git/blobdiff_plain/2bad3743bd25bbcfe12db50e2b18ab8d070f2354..5b661514c1bbabd8205fdbd22a0ba0f6b1ac6305:/pypol/polyhedra.py?ds=sidebyside 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)