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

Commit

Permalink
Polyhedron_polymake: Work around polymake bug with zero inequalities …
Browse files Browse the repository at this point in the history
…over quadratic extensions
  • Loading branch information
mkoeppe committed Mar 30, 2017
1 parent 952b860 commit 4070c66
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/sage/geometry/polyhedron/backend_polymake.py
Expand Up @@ -306,7 +306,19 @@ def _init_from_Hrepresentation(self, ieqs, eqns, minimize=True, verbose=False):
from sage.interfaces.polymake import polymake
if ieqs is None: ieqs = []
if eqns is None: eqns = []
def filter_out_all_zero(list):
if any(all(self._is_zero(x) for x in v) for v in list):
return [ v for v in list if not all(self._is_zero(x) for x in v) ]
else:
return list
# Polymake 3.0r2 and 3.1 crash with a segfault for a test case
# using QuadraticExtension, when some all-zero inequalities are input.
# https://forum.polymake.org/viewtopic.php?f=8&t=547
# Filter them out.
ieqs = filter_out_all_zero(ieqs)
if not ieqs:
# Put in one trivial (all-zero) inequality. This is so that
# the ambient dimension is set correctly.
ieqs.append([0] + [0]*self.ambient_dim())
polymake_field = polymake(self.base_ring().fraction_field())
p = polymake.new_object("Polytope<{}>".format(polymake_field),
Expand Down

0 comments on commit 4070c66

Please sign in to comment.