Skip to content

Commit

Permalink
Polyhedron_ZZ.normal_form: Reject unbounded polyhedra
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthias Koeppe committed Sep 7, 2023
1 parent 19e29d7 commit 679aae0
Showing 1 changed file with 21 additions and 5 deletions.
26 changes: 21 additions & 5 deletions src/sage/geometry/polyhedron/base_ZZ.py
Original file line number Diff line number Diff line change
Expand Up @@ -837,9 +837,10 @@ def is_known_summand(poly):

def normal_form(self, algorithm="palp_native", permutation=False):
r"""
Return the normal form of vertices of ``self`` if ``self`` is a lattice polytope,
i.e. all vertices have integer coordinates. For more more detail,
see also :meth:`~sage.geometry.lattice_polytope.LatticePolytopeClass.normal_form`.
Return the normal form of vertices of the lattice polytope ``self``.
For more more detail,
see :meth:`~sage.geometry.lattice_polytope.LatticePolytopeClass.normal_form`.
EXAMPLES:
Expand Down Expand Up @@ -867,12 +868,27 @@ def normal_form(self, algorithm="palp_native", permutation=False):
sage: p.normal_form()
Traceback (most recent call last):
...
ValueError: normal form is not defined for A 2-dimensional polyhedron in ZZ^3 defined as the convex hull of 4 vertices
ValueError: normal form is not defined for lower-dimensional polyhedra, got
A 2-dimensional polyhedron in ZZ^3 defined as the convex hull of 4 vertices
The normal form is also not defined for unbounded polyhedra::
sage: p = Polyhedron(vertices=[[1, 1]], rays=[[1, 0], [0, 1]], base_ring=ZZ)
sage: p.normal_form()
Traceback (most recent call last):
...
ValueError: normal form is not defined for unbounded polyhedra, got
A 2-dimensional polyhedron in ZZ^2 defined as the convex hull of 1 vertex and 2 rays
See :issue:`15280` for proposed extensions to these cases.
"""
from sage.geometry.palp_normal_form import _palp_PM_max, _palp_canonical_order

if self.dim() < self.ambient_dim():
raise ValueError("normal form is not defined for %s" % self)
raise ValueError("normal form is not defined for lower-dimensional polyhedra, got %s" % self)

if not self.is_compact():
raise ValueError("normal form is not defined for unbounded polyhedra, got %s" % self)

PM = self.slack_matrix().transpose()
PM_max, permutations = _palp_PM_max(PM, check=True)
Expand Down

0 comments on commit 679aae0

Please sign in to comment.