From 41eb6979c79cc39b6d220d855a66293f74b4ae9e Mon Sep 17 00:00:00 2001 From: Jonathan Kliem Date: Mon, 28 Oct 2019 17:58:10 +0100 Subject: [PATCH] important attributes of iterator in structure --- .../combinatorial_polyhedron/base.pyx | 12 +- .../combinatorial_face.pyx | 12 +- .../face_iterator.pxd | 61 ++++--- .../face_iterator.pyx | 169 +++++++++--------- .../polyhedron_face_lattice.pyx | 12 +- 5 files changed, 136 insertions(+), 130 deletions(-) diff --git a/src/sage/geometry/polyhedron/combinatorial_polyhedron/base.pyx b/src/sage/geometry/polyhedron/combinatorial_polyhedron/base.pyx index 969c9f86db1..414bcaa153e 100644 --- a/src/sage/geometry/polyhedron/combinatorial_polyhedron/base.pyx +++ b/src/sage/geometry/polyhedron/combinatorial_polyhedron/base.pyx @@ -1671,7 +1671,7 @@ cdef class CombinatorialPolyhedron(SageObject): cdef simpliciality = dim - 1 # For each face in the iterator, check if its a simplex. - face_iter.lowest_dimension = 2 # every 1-face is a simplex + face_iter.structure.lowest_dimension = 2 # every 1-face is a simplex d = face_iter.next_dimension() while (d < dim): sig_check() @@ -1785,7 +1785,7 @@ cdef class CombinatorialPolyhedron(SageObject): cdef simplicity = dim - 1 # For each coface in the iterator, check if its a simplex. - coface_iter.lowest_dimension = 2 # every coface of dimension 1 is a simplex + coface_iter.structure.lowest_dimension = 2 # every coface of dimension 1 is a simplex d = coface_iter.next_dimension() while (d < dim): sig_check() @@ -2680,8 +2680,8 @@ cdef class CombinatorialPolyhedron(SageObject): face_iter.set_atom_rep() # Copy the information. - edges[one][2*two] = face_iter.atom_rep[0] - edges[one][2*two + 1] = face_iter.atom_rep[1] + edges[one][2*two] = face_iter.structure.atom_rep[0] + edges[one][2*two + 1] = face_iter.structure.atom_rep[1] counter += 1 # Success, copy the data to ``CombinatorialPolyhedron``. @@ -2853,8 +2853,8 @@ cdef class CombinatorialPolyhedron(SageObject): face_iter.set_coatom_rep() # Copy the information. - ridges[one][2*two] = face_iter.coatom_rep[0] - ridges[one][2*two + 1] = face_iter.coatom_rep[1] + ridges[one][2*two] = face_iter.structure.coatom_rep[0] + ridges[one][2*two + 1] = face_iter.structure.coatom_rep[1] counter += 1 # Success, copy the data to ``CombinatorialPolyhedron``. diff --git a/src/sage/geometry/polyhedron/combinatorial_polyhedron/combinatorial_face.pyx b/src/sage/geometry/polyhedron/combinatorial_polyhedron/combinatorial_face.pyx index 777725378fa..9302b7334ed 100644 --- a/src/sage/geometry/polyhedron/combinatorial_polyhedron/combinatorial_face.pyx +++ b/src/sage/geometry/polyhedron/combinatorial_polyhedron/combinatorial_face.pyx @@ -166,19 +166,19 @@ cdef class CombinatorialFace(SageObject): # Copy data from FaceIterator. it = data self._dual = it.dual - self.face_mem = ListOfFaces(1, it.face_length*64) + self.face_mem = ListOfFaces(1, it.structure.face_length*64) self.face = self.face_mem.data[0] - memcpy(self.face, it.face, it.face_length*8) + memcpy(self.face, it.structure.face, it.structure.face_length*8) self._mem = MemoryAllocator() - self._dimension = it.current_dimension - self._ambient_dimension = it.dimension - self.face_length = it.face_length + self._dimension = it.structure.current_dimension + self._ambient_dimension = it.structure.dimension + self.face_length = it.structure.face_length self._ambient_Vrep = it._Vrep self._ambient_facets = it._facet_names self._equalities = it._equalities self.atoms = it.atoms self.coatoms = it.coatoms - self._hash_index = it._index + self._hash_index = it.structure._index elif isinstance(data, PolyhedronFaceLattice): all_faces = data diff --git a/src/sage/geometry/polyhedron/combinatorial_polyhedron/face_iterator.pxd b/src/sage/geometry/polyhedron/combinatorial_polyhedron/face_iterator.pxd index 0e3a9e5cd58..4b601ec4217 100644 --- a/src/sage/geometry/polyhedron/combinatorial_polyhedron/face_iterator.pxd +++ b/src/sage/geometry/polyhedron/combinatorial_polyhedron/face_iterator.pxd @@ -5,27 +5,17 @@ from sage.structure.sage_object cimport SageObject from .list_of_faces cimport ListOfFaces from .combinatorial_face cimport CombinatorialFace -@cython.final -cdef class FaceIterator(SageObject): - cdef readonly bint dual # if 1, then iterate over dual Polyhedron - cdef uint64_t *face # the current face of the iterator - cdef size_t *atom_rep # a place where atom-representation of face will be stored - cdef size_t *coatom_rep # a place where coatom-representation of face will be stored - cdef int current_dimension # dimension of current face, dual dimension if ``dual`` - cdef int dimension # dimension of the polyhedron - cdef int output_dimension # only faces of this (dual?) dimension are considered - cdef int lowest_dimension # don't consider faces below this (dual?) dimension - cdef size_t _index # this counts the number of seen faces, useful for hasing the faces - cdef MemoryAllocator _mem - cdef tuple newfaces_lists # tuple to hold the ListOfFaces corresponding to maybe_newfaces - cdef size_t face_length # stores length of the faces in terms of uint64_t - - # some copies from ``CombinatorialPolyhedron`` - cdef tuple _Vrep, _facet_names, _equalities - - # Atoms and coatoms are the vertices/facets of the Polyedron. - # If ``dual == 0``, then coatoms are facets, atoms vertices and vice versa. - cdef ListOfFaces atoms, coatoms +cdef struct iter_struct: + bint dual # if 1, then iterate over dual Polyhedron + uint64_t *face # the current face of the iterator + size_t *atom_rep # a place where atom-representaion of face will be stored + size_t *coatom_rep # a place where coatom-representaion of face will be stored + int current_dimension # dimension of current face, dual dimension if ``dual`` + int dimension # dimension of the polyhedron + int output_dimension # only faces of this (dual?) dimension are considered + int lowest_dimension # don't consider faces below this (dual?) dimension + size_t _index # this counts the number of seen faces, useful for hasing the faces + size_t face_length # stores length of the faces in terms of uint64_t # ``visited_all`` points to faces, of which we have visited all faces already. # The number of faces in ``visited_all` might depend on the current dimension: @@ -37,18 +27,18 @@ cdef class FaceIterator(SageObject): # In this way, we will append ``visited_all`` in lower dimension, but # will ignore those changes when going up in dimension again. # This is why the number of faces in ``visited_all``depends on dimension. - cdef uint64_t **visited_all - cdef size_t *n_visited_all + uint64_t **visited_all + size_t *n_visited_all # ``maybe_newfaces`` is where all possible facets of a face are stored. # In dimension ``dim`` when visiting all faces of some face, # the intersections with other faces are stored in ``newfaces2[dim]``. - cdef uint64_t ***maybe_newfaces + uint64_t ***maybe_newfaces # ``newfaces`` will point to those faces in ``maybe_newfaces`` # that are of codimension 1 and not already visited. - cdef uint64_t ***newfaces - cdef size_t *n_newfaces # number of newfaces for each dimension + uint64_t ***newfaces + size_t *n_newfaces # number of newfaces for each dimension # After having visited a face completely, we want to add it to ``visited_all``. # ``first_dim[i]`` will indicate, wether there is one more face in @@ -56,11 +46,26 @@ cdef class FaceIterator(SageObject): # that has to be added to ``visited_all``. # If ``first_time[i] == False``, we still need to # add ``newfaces[i][n_newfaces[i]]`` to ``visited_all``. - cdef bint *first_time + bint *first_time # The number of elements in newfaces[current_dimension], # that have not been visited yet. - cdef size_t yet_to_visit + size_t yet_to_visit + + +@cython.final +cdef class FaceIterator(SageObject): + cdef iter_struct structure + cdef readonly bint dual # if 1, then iterate over dual Polyhedron + cdef MemoryAllocator _mem + cdef tuple newfaces_lists # tuple to hold the ListOfFaces corresponding to maybe_newfaces + + # some copies from ``CombinatorialPolyhedron`` + cdef tuple _Vrep, _facet_names, _equalities + + # Atoms and coatoms are the vertices/facets of the Polyedron. + # If ``dual == 0``, then coatoms are facets, atoms vertices and vice versa. + cdef ListOfFaces atoms, coatoms cdef inline CombinatorialFace next_face(self) cdef inline int next_dimension(self) except -1 diff --git a/src/sage/geometry/polyhedron/combinatorial_polyhedron/face_iterator.pyx b/src/sage/geometry/polyhedron/combinatorial_polyhedron/face_iterator.pyx index 8bd8121ee2e..838b8bba8b5 100644 --- a/src/sage/geometry/polyhedron/combinatorial_polyhedron/face_iterator.pyx +++ b/src/sage/geometry/polyhedron/combinatorial_polyhedron/face_iterator.pyx @@ -416,65 +416,66 @@ cdef class FaceIterator(SageObject): cdef ListOfFaces some_list # make Cython aware of type self.dual = dual - self.face = NULL - self.dimension = C.dimension() - self.current_dimension = self.dimension -1 + self.structure.dual = dual + self.structure.face = NULL + self.structure.dimension = C.dimension() + self.structure.current_dimension = self.structure.dimension -1 self._mem = MemoryAllocator() # We will not yield the empty face. # If there are `n` lines, than there # are no faces below dimension `n`. # The dimension of the level-sets in the face lattice jumps from `n` to `-1`. - self.lowest_dimension = 0 + self.structure.lowest_dimension = 0 if output_dimension is not None: - if not output_dimension in range(0,self.dimension): + if not output_dimension in range(0,self.structure.dimension): raise ValueError("``output_dimension`` must be the dimension of proper faces") if self.dual: # In dual mode, the dimensions are reversed. - self.output_dimension = self.dimension - 1 - output_dimension + self.structure.output_dimension = self.structure.dimension - 1 - output_dimension else: - self.output_dimension = output_dimension - self.lowest_dimension = max(0, self.output_dimension) + self.structure.output_dimension = output_dimension + self.structure.lowest_dimension = max(0, self.structure.output_dimension) else: - self.output_dimension = -2 + self.structure.output_dimension = -2 if dual: self.atoms = C.bitrep_facets() self.coatoms = C.bitrep_Vrep() else: self.coatoms = C.bitrep_facets() - self.atoms = C.bitrep_Vrep() - self.face_length = self.coatoms.face_length + self.atoms = C.bitrep_Vrep() + self.structure.face_length = self.coatoms.face_length self._Vrep = C.Vrep() self._facet_names = C.facet_names() self._equalities = C.equalities() - self.atom_rep = self._mem.allocarray(self.coatoms.n_atoms, sizeof(size_t)) - self.coatom_rep = self._mem.allocarray(self.coatoms.n_faces, sizeof(size_t)) + self.structure.atom_rep = self._mem.allocarray(self.coatoms.n_atoms, sizeof(size_t)) + self.structure.coatom_rep = self._mem.allocarray(self.coatoms.n_faces, sizeof(size_t)) - if self.dimension == 0 or self.coatoms.n_faces == 0: + if self.structure.dimension == 0 or self.coatoms.n_faces == 0: # As we will only yield proper faces, # there is nothing to yield in those cases. # We have to discontinue initialization, # as it assumes ``self.dimension > 0`` and ``self.n_faces > 0``. - self.current_dimension = self.dimension + self.structure.current_dimension = self.structure.dimension return # We may assume ``dimension > 0`` and ``n_faces > 0``. # Initialize ``maybe_newfaces``, # the place where the new faces are being stored. self.newfaces_lists = tuple(ListOfFaces(self.coatoms.n_faces, self.coatoms.n_atoms) - for i in range(self.dimension -1)) - self.maybe_newfaces = self._mem.allocarray((self.dimension -1), sizeof(uint64_t **)) - for i in range(self.dimension -1): + for i in range(self.structure.dimension -1)) + self.structure.maybe_newfaces = self._mem.allocarray((self.structure.dimension -1), sizeof(uint64_t **)) + for i in range(self.structure.dimension -1): some_list = self.newfaces_lists[i] - self.maybe_newfaces[i] = some_list.data + self.structure.maybe_newfaces[i] = some_list.data # Initialize ``visited_all``. - self.visited_all = self._mem.allocarray(self.coatoms.n_faces, sizeof(uint64_t *)) - self.n_visited_all = self._mem.allocarray(self.dimension, sizeof(size_t)) - self.n_visited_all[self.dimension -1] = 0 + self.structure.visited_all = self._mem.allocarray(self.coatoms.n_faces, sizeof(uint64_t *)) + self.structure.n_visited_all = self._mem.allocarray(self.structure.dimension, sizeof(size_t)) + self.structure.n_visited_all[self.structure.dimension -1] = 0 if not C.is_bounded(): # Treating the far face as if we had visited all its elements. # Hence we will visit all intersections of facets unless contained in the far face. @@ -485,26 +486,26 @@ cdef class FaceIterator(SageObject): # Hence it is fine to use the first entry already for the far face, # as ``self.visited_all`` holds ``n_facets`` pointers. some_list = C.far_face() - self.visited_all[0] = some_list.data[0] - self.n_visited_all[self.dimension -1] = 1 + self.structure.visited_all[0] = some_list.data[0] + self.structure.n_visited_all[self.structure.dimension -1] = 1 # Initialize ``newfaces``, which will point to the new faces of codimension 1, # which have not been visited yet. - self.newfaces = self._mem.allocarray(self.dimension, sizeof(uint64_t **)) - for i in range(self.dimension - 1): - self.newfaces[i] = self._mem.allocarray(self.coatoms.n_faces, sizeof(uint64_t *)) - self.newfaces[self.dimension - 1] = self.coatoms.data # we start with coatoms + self.structure.newfaces = self._mem.allocarray(self.structure.dimension, sizeof(uint64_t **)) + for i in range(self.structure.dimension - 1): + self.structure.newfaces[i] = self._mem.allocarray(self.coatoms.n_faces, sizeof(uint64_t *)) + self.structure.newfaces[self.structure.dimension - 1] = self.coatoms.data # we start with coatoms # Initialize ``n_newfaces``. - self.n_newfaces = self._mem.allocarray(self.dimension, sizeof(size_t)) - self.n_newfaces[self.dimension - 1] = self.coatoms.n_faces + self.structure.n_newfaces = self._mem.allocarray(self.structure.dimension, sizeof(size_t)) + self.structure.n_newfaces[self.structure.dimension - 1] = self.coatoms.n_faces # Initialize ``first_time``. - self.first_time = self._mem.allocarray(self.dimension, sizeof(bint)) - self.first_time[self.dimension - 1] = True + self.structure.first_time = self._mem.allocarray(self.structure.dimension, sizeof(bint)) + self.structure.first_time[self.structure.dimension - 1] = True - self.yet_to_visit = self.coatoms.n_faces - self._index = 0 + self.structure.yet_to_visit = self.coatoms.n_faces + self.structure._index = 0 def _repr_(self): r""" @@ -518,16 +519,16 @@ cdef class FaceIterator(SageObject): sage: C.face_iter(1) Iterator over the 1-faces of a 3-dimensional combinatorial polyhedron """ - if self.output_dimension != -2: + if self.structure.output_dimension != -2: if self.dual: # ouput_dimension is stored with respect to the dual - intended_dimension = self.dimension - 1 - self.output_dimension + intended_dimension = self.structure.dimension - 1 - self.structure.output_dimension else: - intended_dimension = self.output_dimension + intended_dimension = self.structure.output_dimension output = "Iterator over the {}-faces".format(intended_dimension) else: output = "Iterator over the proper faces" - return output + " of a {}-dimensional combinatorial polyhedron".format(self.dimension) + return output + " of a {}-dimensional combinatorial polyhedron".format(self.structure.dimension) def __next__(self): r""" @@ -547,7 +548,7 @@ cdef class FaceIterator(SageObject): A 1-dimensional face of a 3-dimensional combinatorial polyhedron] """ cdef CombinatorialFace face = self.next_face() - if unlikely(self.current_dimension == self.dimension): + if unlikely(self.structure.current_dimension == self.structure.dimension): raise StopIteration return face @@ -618,15 +619,15 @@ cdef class FaceIterator(SageObject): """ if unlikely(self.dual): raise ValueError("only possible when not in dual mode") - if unlikely(self.face is NULL): + if unlikely(self.structure.face is NULL): raise ValueError("iterator not set to a face yet") # The current face is added to ``visited_all``. # This will make the iterator skip those faces. # Also, this face will not be added a second time to ``visited_all``, # as there are no new faces. - self.visited_all[self.n_visited_all[self.current_dimension]] = self.face - self.n_visited_all[self.current_dimension] += 1 + self.structure.visited_all[self.structure.n_visited_all[self.structure.current_dimension]] = self.structure.face + self.structure.n_visited_all[self.structure.current_dimension] += 1 def ignore_supfaces(self): r""" @@ -651,15 +652,15 @@ cdef class FaceIterator(SageObject): """ if unlikely(not self.dual): raise ValueError("only possible when in dual mode") - if unlikely(self.face is NULL): + if unlikely(self.structure.face is NULL): raise ValueError("iterator not set to a face yet") # The current face is added to ``visited_all``. # This will make the iterator skip those faces. # Also, this face will not be added a second time to ``visited_all``, # as there are no new faces. - self.visited_all[self.n_visited_all[self.current_dimension]] = self.face - self.n_visited_all[self.current_dimension] += 1 + self.structure.visited_all[self.structure.n_visited_all[self.structure.current_dimension]] = self.structure.face + self.structure.n_visited_all[self.structure.current_dimension] += 1 cdef inline CombinatorialFace next_face(self): r""" @@ -667,7 +668,7 @@ cdef class FaceIterator(SageObject): :class:`sage.geometry.polyhedron.combinatorial_polyhedron.combinatorial_face.CombinatorialFace`. """ self.next_dimension() - if unlikely(self.current_dimension == self.dimension): + if unlikely(self.structure.current_dimension == self.structure.dimension): return None return CombinatorialFace(self) @@ -690,11 +691,11 @@ cdef class FaceIterator(SageObject): visiting sub-/supfaces instead of after. One cannot arbitrarily add faces to ``visited_all``, as visited_all has a maximal length. """ - cdef int dim = self.dimension - while (not self.next_face_loop()) and (self.current_dimension < dim): + cdef int dim = self.structure.dimension + while (not self.next_face_loop()) and (self.structure.current_dimension < dim): sig_check() - self._index += 1 - return self.current_dimension + self.structure._index += 1 + return self.structure.current_dimension cdef inline int next_face_loop(self) except -1: r""" @@ -704,53 +705,53 @@ cdef class FaceIterator(SageObject): If ``self.current_dimension == self.dimension``, then the iterator is consumed. """ - if unlikely(self.current_dimension == self.dimension): + if unlikely(self.structure.current_dimension == self.structure.dimension): # The function is not supposed to be called, # just prevent it from crashing. raise StopIteration # Getting ``[faces, n_faces, n_visited_all]`` according to dimension. - cdef uint64_t **faces = self.newfaces[self.current_dimension] - cdef size_t n_faces = self.n_newfaces[self.current_dimension] - cdef size_t n_visited_all = self.n_visited_all[self.current_dimension] + cdef uint64_t **faces = self.structure.newfaces[self.structure.current_dimension] + cdef size_t n_faces = self.structure.n_newfaces[self.structure.current_dimension] + cdef size_t n_visited_all = self.structure.n_visited_all[self.structure.current_dimension] - if (self.output_dimension > -2) and (self.output_dimension != self.current_dimension): + if (self.structure.output_dimension > -2) and (self.structure.output_dimension != self.structure.current_dimension): # If only a specific dimension was requested (i.e. ``self.output_dimension > -2``), # then we will not yield faces in other dimension. - self.yet_to_visit = 0 + self.structure.yet_to_visit = 0 - if self.yet_to_visit: + if self.structure.yet_to_visit: # Set ``face`` to the next face. - self.yet_to_visit -= 1 - self.face = faces[self.yet_to_visit] + self.structure.yet_to_visit -= 1 + self.structure.face = faces[self.structure.yet_to_visit] return 1 - if self.current_dimension <= self.lowest_dimension: + if self.structure.current_dimension <= self.structure.lowest_dimension: # We will not yield the empty face. # We will not yield below requested dimension. - self.current_dimension += 1 + self.structure.current_dimension += 1 return 0 if n_faces <= 1: # There will be no more faces from intersections. - self.current_dimension += 1 + self.structure.current_dimension += 1 return 0 # We will visit the last face now. - self.n_newfaces[self.current_dimension] -= 1 + self.structure.n_newfaces[self.structure.current_dimension] -= 1 n_faces -= 1 - if not self.first_time[self.current_dimension]: + if not self.structure.first_time[self.structure.current_dimension]: # In this case there exists ``faces[n_faces + 1]``, of which we # have visited all faces, but which was not added to # ``visited_all`` yet. - self.visited_all[n_visited_all] = faces[n_faces + 1] - self.n_visited_all[self.current_dimension] += 1 - n_visited_all = self.n_visited_all[self.current_dimension] + self.structure.visited_all[n_visited_all] = faces[n_faces + 1] + self.structure.n_visited_all[self.structure.current_dimension] += 1 + n_visited_all = self.structure.n_visited_all[self.structure.current_dimension] else: # Once we have visited all faces of ``faces[n_faces]``, we want # to add it to ``visited_all``. - self.first_time[self.current_dimension] = False + self.structure.first_time[self.structure.current_dimension] = False # Get the faces of codimension 1 contained in ``faces[n_faces]``, # which we have not yet visited. @@ -758,9 +759,9 @@ cdef class FaceIterator(SageObject): sig_on() newfacescounter = get_next_level( - faces, n_faces + 1, self.maybe_newfaces[self.current_dimension-1], - self.newfaces[self.current_dimension-1], - self.visited_all, n_visited_all, self.face_length) + faces, n_faces + 1, self.structure.maybe_newfaces[self.structure.current_dimension-1], + self.structure.newfaces[self.structure.current_dimension-1], + self.structure.visited_all, n_visited_all, self.structure.face_length) sig_off() if newfacescounter: @@ -768,11 +769,11 @@ cdef class FaceIterator(SageObject): # We will visted them on next call, starting with codimension 1. # Setting the variables correclty for next call of ``next_face_loop``. - self.current_dimension -= 1 - self.first_time[self.current_dimension] = True - self.n_newfaces[self.current_dimension] = newfacescounter - self.n_visited_all[self.current_dimension] = n_visited_all - self.yet_to_visit = newfacescounter + self.structure.current_dimension -= 1 + self.structure.first_time[self.structure.current_dimension] = True + self.structure.n_newfaces[self.structure.current_dimension] = newfacescounter + self.structure.n_visited_all[self.structure.current_dimension] = n_visited_all + self.structure.yet_to_visit = newfacescounter return 0 else: # ``faces[n_faces]`` contains no new faces. @@ -782,7 +783,7 @@ cdef class FaceIterator(SageObject): # this step needs to be done, as ``faces[n_faces]`` might # have been added manually to ``visited_all``. # So this step is required to respect boundaries of ``visited_all``. - self.first_time[self.current_dimension] = True + self.structure.first_time[self.structure.current_dimension] = True return 0 cdef size_t n_atom_rep(self) except -1: @@ -792,8 +793,8 @@ cdef class FaceIterator(SageObject): This is a shortcut of :class:`sage.geometry.polyhedron.combinatorial_polyhedron.combinatorial_face.CombinatorialFace.n_atom_rep` """ - if self.face: - return count_atoms(self.face, self.face_length) + if self.structure.face: + return count_atoms(self.structure.face, self.structure.face_length) # The face was not initialized properly. raise LookupError("``FaceIterator`` does not point to a face") @@ -807,9 +808,9 @@ cdef class FaceIterator(SageObject): """ cdef size_t n_coatoms = self.coatoms.n_faces cdef uint64_t **coatoms = self.coatoms.data - cdef size_t face_length = self.face_length - return bit_rep_to_coatom_rep(self.face, coatoms, n_coatoms, - face_length, self.coatom_rep) + cdef size_t face_length = self.structure.face_length + return bit_rep_to_coatom_rep(self.structure.face, coatoms, n_coatoms, + face_length, self.structure.coatom_rep) cdef size_t set_atom_rep(self) except -1: r""" @@ -818,5 +819,5 @@ cdef class FaceIterator(SageObject): This is a shortcut of :class:`sage.geometry.polyhedron.combinatorial_polyhedron.combinatorial_face.CombinatorialFace.set_atom_rep` """ - cdef size_t face_length = self.face_length - return bit_rep_to_Vrep_list(self.face, self.atom_rep, face_length) + cdef size_t face_length = self.structure.face_length + return bit_rep_to_Vrep_list(self.structure.face, self.structure.atom_rep, face_length) diff --git a/src/sage/geometry/polyhedron/combinatorial_polyhedron/polyhedron_face_lattice.pyx b/src/sage/geometry/polyhedron/combinatorial_polyhedron/polyhedron_face_lattice.pyx index aeed515b5c6..ae55be15488 100644 --- a/src/sage/geometry/polyhedron/combinatorial_polyhedron/polyhedron_face_lattice.pyx +++ b/src/sage/geometry/polyhedron/combinatorial_polyhedron/polyhedron_face_lattice.pyx @@ -133,7 +133,7 @@ cdef class PolyhedronFaceLattice: if not C.is_bounded(): self.dual = False cdef FaceIterator face_iter = C._face_iter(self.dual, -2) - self.face_length = face_iter.face_length + self.face_length = face_iter.structure.face_length self._Vrep = C.Vrep() self._facet_names = C.facet_names() self._equalities = C.equalities() @@ -203,14 +203,14 @@ cdef class PolyhedronFaceLattice: # Adding all faces, using the iterator. cdef int d - if face_iter.current_dimension != self.dimension: + if face_iter.structure.current_dimension != self.dimension: # If there are proper faces. d = face_iter.next_dimension() while (d == self.dimension - 1): # We already have the coatoms. d = face_iter.next_dimension() while (d < self.dimension): - self._add_face(d, face_iter.face) + self._add_face(d, face_iter.structure.face) d = face_iter.next_dimension() # Sorting the faces, except for coatoms. @@ -343,7 +343,7 @@ cdef class PolyhedronFaceLattice: ....: cdef PolyhedronFaceLattice all_faces = C._all_faces ....: if not (all_faces.dual == it.dual): ....: raise ValueError("iterator and allfaces not in same mode") - ....: return all_faces.find_face(face_iter.current_dimension, face_iter.face) + ....: return all_faces.find_face(face_iter.structure.current_dimension, face_iter.structure.face) ....: ''') sage: P = polytopes.permutahedron(4) sage: C = CombinatorialPolyhedron(P) @@ -425,12 +425,12 @@ cdef class PolyhedronFaceLattice: ....: def face_via_all_faces_from_iterator(it, C1): ....: cdef FaceIterator face_iter = it ....: cdef CombinatorialPolyhedron C = C1 - ....: cdef int dimension = face_iter.current_dimension + ....: cdef int dimension = face_iter.structure.current_dimension ....: C._record_all_faces() ....: cdef PolyhedronFaceLattice all_faces = C._all_faces ....: if not (all_faces.dual == it.dual): ....: raise ValueError("iterator and allfaces not in same mode") - ....: index = all_faces.find_face(dimension, face_iter.face) + ....: index = all_faces.find_face(dimension, face_iter.structure.face) ....: return all_faces.get_face(dimension, index) ....: ''') sage: P = polytopes.permutahedron(4)