Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
take care of special cases
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonathan Kliem committed Dec 2, 2019
1 parent 984cc62 commit a75d3b2
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions src/sage/geometry/polyhedron/backend_normaliz.py
Original file line number Diff line number Diff line change
Expand Up @@ -1193,8 +1193,46 @@ def __setstate__(self, state):
sage: P1 = loads(dumps(P)) # indirect doctest # optional - pynormaliz
sage: P1.volume(measure='induced_lattice', engine='normaliz') # optional - pynormaliz
96
Test that the obtained cone is valid::
sage: from sage.geometry.polyhedron.backend_normaliz import Polyhedron_normaliz # optional - pynormaliz
sage: P = polytopes.permutahedron(4, backend='normaliz') # optional - pynormaliz
sage: P1 = loads(dumps(P)) # optional - pynormaliz
sage: P2 = Polyhedron_normaliz(P1.parent(), None, None, P1._normaliz_cone) # optional - pynormaliz
sage: P2 == P # optional - pynormaliz
True
sage: P = Polyhedron(lines=[[1,0], [0,1]], backend='normaliz') # optional - pynormaliz
sage: P1 = loads(dumps(P)) # optional - pynormaliz
sage: P2 = Polyhedron_normaliz(P1.parent(), None, None, P1._normaliz_cone) # optional - pynormaliz
sage: P2 == P # optional - pynormaliz
True
sage: P = Polyhedron(backend='normaliz') # optional - pynormaliz
sage: P1 = loads(dumps(P)) # optional - pynormaliz
sage: P2 = Polyhedron_normaliz(P1.parent(), None, None, P1._normaliz_cone) # optional - pynormaliz
sage: P2 == P # optional - pynormaliz
True
sage: P = polytopes.permutahedron(4, backend='normaliz') * Polyhedron(lines=[[1]], backend='normaliz')
sage: P1 = loads(dumps(P))
sage: P2 = Polyhedron_normaliz(P1.parent(), None, None, P1._normaliz_cone)
sage: P2 == P
True
"""
super(Polyhedron_normaliz, self).__setstate__(state)

if not self.inequalities():
# If there are no inequalites, we must initialize the cone from scratch.
P = Polyhedron_normaliz(self.parent(), [self.vertices(), self.rays(), self.lines()], None)
self._normaliz_cone = P._normaliz_cone
return

if self.is_empty():
# Special case to avoid.
self._normaliz_cone = None

self._normaliz_cone = \
self._cone_from_Vrepresentation_and_Hrepresentation(
self.vertices(), self.rays(), self.inequalities(), self.equations())
Expand Down

0 comments on commit a75d3b2

Please sign in to comment.