Skip to content

Commit

Permalink
Polyhedron_base1.an_affine_basis: Implement for the non-pointed case
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthias Koeppe committed Aug 9, 2022
1 parent 5f3a8ed commit bfe56c6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 13 deletions.
6 changes: 2 additions & 4 deletions src/sage/geometry/cone.py
Original file line number Diff line number Diff line change
Expand Up @@ -3538,10 +3538,8 @@ def an_affine_basis(self):
sage: ray.an_affine_basis()
[(0, 0), (1, 1)]
sage: line = Cone([(1,0), (-1,0)])
sage: line.an_affine_basis() # FIXME
Traceback (most recent call last):
...
NameError: free variable 'vertex' referenced before assignment in enclosing scope
sage: line.an_affine_basis()
[(1, 0), (0, 0)]
"""
return [vector(v) for v in self.polyhedron().an_affine_basis()]

Expand Down
13 changes: 4 additions & 9 deletions src/sage/geometry/polyhedron/base1.py
Original file line number Diff line number Diff line change
Expand Up @@ -465,14 +465,9 @@ def an_affine_basis(self):
sage: p.an_affine_basis()
[A vertex at (2, 1), (3, 1), (2, 2)]
sage: p = Polyhedron(vertices=[(2, 1)], rays=[(1,0)], lines=[(0,1)])
sage: p.an_affine_basis() # FIXME
Traceback (most recent call last):
...
NameError: free variable 'vertex' referenced before assignment in enclosing scope
sage: p.an_affine_basis()
[(2, 1), A vertex at (2, 0), (3, 0)]
"""
## if not self.is_compact():
## raise NotImplementedError("this function is not implemented for unbounded polyhedra")

chain = self.a_maximal_chain()[1:] # we exclude the empty face
chain_indices = [face.ambient_V_indices() for face in chain]
basis_indices = []
Expand All @@ -482,8 +477,8 @@ def an_affine_basis(self):
# Thus for each two faces we can easily find the first Vrep that differs.
for dim, face in enumerate(chain_indices):
if dim == 0:
# Append the V-index.
basis_indices.append(face[0])
# Append the V-indices of the minimal face.
basis_indices.extend(face[:])
continue

prev_face = chain_indices[dim-1]
Expand Down

0 comments on commit bfe56c6

Please sign in to comment.