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

Commit 04ca6fb

Browse files
author
Jonathan Kliem
committed
further improvement for face iterator over simple/simplicial polytopes
1 parent 78bfb6c commit 04ca6fb

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

src/sage/geometry/polyhedron/combinatorial_polyhedron/face_iterator.pyx

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1970,7 +1970,13 @@ cdef inline int next_face_loop(iter_t structure) nogil except -1:
19701970
# In this case there exists ``faces[0].faces[n_faces]``, of which we
19711971
# have visited all faces, but which was not added to
19721972
# ``visited_all`` yet.
1973-
add_face_shallow(visited_all[0], faces[0].faces[n_faces])
1973+
1974+
if not faces[0].polyhedron_is_simple:
1975+
# In case of a simple lattice, this step needs not to be applied:
1976+
# Every element, except the lower bound, has a unique representation of coatoms in this case.
1977+
# Hence, as the face is already removed from faces[0], any subfaces will not be visited.
1978+
# (If we manually ignore subfaces, faces will still be added to visited_all).
1979+
add_face_shallow(visited_all[0], faces[0].faces[n_faces])
19741980
else:
19751981
# Once we have visited all faces of ``faces[n_faces]``, we want
19761982
# to add it to ``visited_all``.
@@ -2193,7 +2199,14 @@ cdef inline int prepare_face_iterator_for_partial_job(
21932199

21942200
for i in range(job_id_c):
21952201
# Fast forwarding the jobs.
2196-
add_face_shallow(structure.visited_all[d], structure.new_faces[d].faces[structure.new_faces[d].n_faces -1])
2202+
2203+
if not structure.new_faces[d].polyhedron_is_simple:
2204+
# In case of a simple lattice, this step needs not to be applied:
2205+
# Every element, except the lower bound, has a unique representation of coatoms in this case.
2206+
# Hence, as the face is already removed from faces[0], any subfaces will not be visited.
2207+
# (If we manually ignore subfaces, faces will still be added to visited_all).
2208+
add_face_shallow(structure.visited_all[d], structure.new_faces[d].faces[structure.new_faces[d].n_faces -1])
2209+
21972210
structure.new_faces[d].n_faces -= 1
21982211

21992212
parallel_struct.current_job_id[current_depth -1] = job_id_c

0 commit comments

Comments
 (0)