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

Commit

Permalink
some details in polyhedron/base
Browse files Browse the repository at this point in the history
  • Loading branch information
fchapoton committed Aug 11, 2022
1 parent c648547 commit 0fdd5a2
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/sage/geometry/polyhedron/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,11 +311,11 @@ def to_linear_program(self, solver=None, return_variable=False, base_ring=None):

for ineqn in self.inequalities_list():
b = -ineqn.pop(0)
p.add_constraint(p.sum([x[i]*ineqn[i] for i in range(len(ineqn))]) >= b)
p.add_constraint(p.sum([x[i] * ineqn[i] for i in range(len(ineqn))]) >= b)

for eqn in self.equations_list():
b = -eqn.pop(0)
p.add_constraint(p.sum([x[i]*eqn[i] for i in range(len(eqn))]) == b)
p.add_constraint(p.sum([x[i] * eqn[i] for i in range(len(eqn))]) == b)

if return_variable:
return p, x
Expand Down Expand Up @@ -402,7 +402,7 @@ def center(self):
if self.dim() == 0:
return self.vertices()[0].vector()
else:
vertex_sum = vector(self.base_ring(), [0]*self.ambient_dim())
vertex_sum = vector(self.base_ring(), [0] * self.ambient_dim())
for v in self.vertex_generator():
vertex_sum += v.vector()
vertex_sum.set_immutable()
Expand Down Expand Up @@ -1198,9 +1198,10 @@ def _polymake_init_(self):
INEQUALITIES=self.inequalities_list(),
EQUATIONS=self.equations_list())

verts_and_rays = [[1] + v for v in self.vertices_list()]
verts_and_rays += [[0] + r for r in self.rays_list()]
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()],
VERTICES=verts_and_rays,
LINEALITY_SPACE=[[0] + l for l in self.lines_list()])

0 comments on commit 0fdd5a2

Please sign in to comment.