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

Commit

Permalink
Polyhedron_base._polymake_init_: Add work around for empty polytopes …
Browse files Browse the repository at this point in the history
…with Polymake 3.0
  • Loading branch information
mkoeppe committed Mar 28, 2017
1 parent 8812e9c commit b47f6f9
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions src/sage/geometry/polyhedron/base.py
Expand Up @@ -5453,9 +5453,18 @@ def _polymake_init_(self):
"""
from sage.interfaces.polymake import polymake
polymake_field = polymake(self.base_ring().fraction_field())
return polymake.new_object("Polytope<{}>".format(polymake_field),
FACETS=self.inequalities_list(),
AFFINE_HULL=self.equations_list(),
VERTICES= [ [1] + v for v in self.vertices_list() ] \
+ [ [0] + r for r in self.rays_list() ],
LINEALITY_SPACE=[ [0] + l for l in self.lines_list() ])
polymake_class = "Polytope<{}>".format(polymake_field)
if self.is_empty():
# Polymake 3.0 cannot enter an empty polyhedron using
# FACETS and AFFINE_HULL. Use corresponding input properties instead.
# https://forum.polymake.org/viewtopic.php?f=8&t=545
return polymake.new_object(polymake_class,
INEQUALITIES=self.inequalities_list(),
EQUATIONS=self.equations_list())
else:
return polymake.new_object(polymake_class,
FACETS=self.inequalities_list(),
AFFINE_HULL=self.equations_list(),
VERTICES= [ [1] + v for v in self.vertices_list() ] \
+ [ [0] + r for r in self.rays_list() ],
LINEALITY_SPACE=[ [0] + l for l in self.lines_list() ])

0 comments on commit b47f6f9

Please sign in to comment.