diff --git a/src/sage/geometry/polyhedron/combinatorial_polyhedron/base.pxd b/src/sage/geometry/polyhedron/combinatorial_polyhedron/base.pxd index 0a998c2ca9e..57ff89c2499 100644 --- a/src/sage/geometry/polyhedron/combinatorial_polyhedron/base.pxd +++ b/src/sage/geometry/polyhedron/combinatorial_polyhedron/base.pxd @@ -9,17 +9,17 @@ from .polyhedron_face_lattice cimport PolyhedronFaceLattice @cython.final cdef class CombinatorialPolyhedron(SageObject): # Do not assume any of those attributes to be initialized, use the corresponding methods instead. - cdef tuple _V # the names of VRep, if they exist - cdef tuple _H # the names of HRep, if they exist - cdef tuple _equalities # stores equalities, given on input (might belong to Hrep) - cdef int _dimension # stores dimension, -2 on init + cdef tuple _Vrep # the names of VRep, if they exist + cdef tuple _facet_names # the names of HRep without equalities, if they exist + cdef tuple _equalities # stores equalities, given on input (might belong to Hrep) + cdef int _dimension # stores dimension, -2 on init cdef unsigned int _n_Hrepresentation # Hrepr might include equalities cdef unsigned int _n_Vrepresentation # Vrepr might include rays/lines - cdef size_t _n_facets # length Hrep without equalities - cdef bint _bounded # ``True`` iff Polyhedron is bounded - cdef ListOfFaces _bitrep_facets # facets in bit representation - cdef ListOfFaces _bitrep_Vrepr # vertices in bit representation - cdef ListOfFaces _far_face # a 'face' containing all none-vertices of Vrepr + cdef size_t _n_facets # length Hrep without equalities + cdef bint _bounded # ``True`` iff Polyhedron is bounded + cdef ListOfFaces _bitrep_facets # facets in bit representation + cdef ListOfFaces _bitrep_Vrepr # vertices in bit representation + cdef ListOfFaces _far_face # a 'face' containing all none-vertices of Vrepr cdef tuple _far_face_tuple cdef tuple _f_vector @@ -38,10 +38,10 @@ cdef class CombinatorialPolyhedron(SageObject): cdef size_t _n_ridges cdef size_t **_face_lattice_incidences # stores incidences in Hasse diagram labeled indices of the faces cdef size_t _n_face_lattice_incidences - cdef PolyhedronFaceLattice _all_faces # class to generate Hasse diagram incidences + cdef PolyhedronFaceLattice _all_faces # class to generate Hasse diagram incidences - cdef tuple V(self) - cdef tuple H(self) + cdef tuple Vrep(self) + cdef tuple facet_names(self) cdef tuple equalities(self) cdef unsigned int n_Vrepresentation(self) cdef unsigned int n_Hrepresentation(self) diff --git a/src/sage/geometry/polyhedron/combinatorial_polyhedron/base.pyx b/src/sage/geometry/polyhedron/combinatorial_polyhedron/base.pyx index 76d8a981653..b9f81fd5ffd 100644 --- a/src/sage/geometry/polyhedron/combinatorial_polyhedron/base.pyx +++ b/src/sage/geometry/polyhedron/combinatorial_polyhedron/base.pyx @@ -349,10 +349,10 @@ cdef class CombinatorialPolyhedron(SageObject): if Vrepr: # store vertices names - self._V = tuple(Vrepr) - Vinv = {v: i for i,v in enumerate(self._V)} + self._Vrep = tuple(Vrepr) + Vinv = {v: i for i,v in enumerate(self._Vrep)} else: - self._V = None + self._Vrep = None Vinv = None if facets: @@ -367,11 +367,11 @@ cdef class CombinatorialPolyhedron(SageObject): # will be detected. if not facets[i].is_inequality(): test[i] = 0 - self._H = tuple(facets[i] for i in range(len(facets)) if test[i]) + self._facet_names = tuple(facets[i] for i in range(len(facets)) if test[i]) self._equalities = tuple(facets[i] for i in range(len(facets)) if not test[i]) else: - self._H = None + self._facet_names = None if data == [] or data == (): # Handling the empty polyhedron. @@ -419,22 +419,22 @@ cdef class CombinatorialPolyhedron(SageObject): if is_iterator(data): data = tuple(data) - if self._V is None: + if self._Vrep is None: # Get the names of the Vrepr. Vrepr = sorted(set.union(*map(set, data))) n_Vrepresentation = len(Vrepr) if Vrepr != range(len(Vrepr)): - self._V = tuple(Vrepr) - Vinv = {v: i for i,v in enumerate(self._V)} + self._Vrep = tuple(Vrepr) + Vinv = {v: i for i,v in enumerate(self._Vrep)} else: # Assuming the user gave as correct names for the vertices # and labeled them instead by `0,...,n`. - n_Vrepresentation = len(self._V) + n_Vrepresentation = len(self._Vrep) self._n_Vrepresentation = n_Vrepresentation # Relabel the Vrepr to be `0,...,n`. - if self._V is not None: + if self._Vrep is not None: def f(v): return Vinv[v] else: def f(v): return int(v) @@ -568,8 +568,8 @@ cdef class CombinatorialPolyhedron(SageObject): A vertex at (0, 0, 0), A ray in the direction (0, 1, 0)) """ - if self.V() is not None: - return self.V() + if self.Vrep() is not None: + return self.Vrep() else: return tuple(smallInteger(i) for i in range(self.n_Vrepresentation())) @@ -590,8 +590,8 @@ cdef class CombinatorialPolyhedron(SageObject): An inequality (0, 1, 1) x - 3 >= 0, An inequality (0, 0, 1) x - 1 >= 0) """ - if self.H() is not None: - return self.equalities() + self.H() + if self.facet_names() is not None: + return self.equalities() + self.facet_names() else: return tuple(smallInteger(i) for i in range(self.n_Hrepresentation())) @@ -724,8 +724,8 @@ cdef class CombinatorialPolyhedron(SageObject): """ if unlikely(self.dimension() == 0): # Handling the case of a trivial polyhedron of dimension `0`. - if names and self.V(): - return (self.V()[0],) + if names and self.Vrep(): + return (self.Vrep()[0],) else: return (smallInteger(0),) if not self.is_bounded(): @@ -739,8 +739,8 @@ cdef class CombinatorialPolyhedron(SageObject): except StopIteration: # The Polyhedron has no vertex. return () - if names and self.V(): - return tuple(self.V()[i] for i in range(self.n_Vrepresentation()) if not i in self.far_face_tuple()) + if names and self.Vrep(): + return tuple(self.Vrep()[i] for i in range(self.n_Vrepresentation()) if not i in self.far_face_tuple()) else: return tuple(smallInteger(i) for i in range(self.n_Vrepresentation()) if not i in self.far_face_tuple()) @@ -930,8 +930,8 @@ cdef class CombinatorialPolyhedron(SageObject): # with each array containing ``len_edge_list`` of edges. # Mapping the indices of the Vrepr to the names, if requested. - if self.V() is not None and names is True: - def f(size_t i): return self.V()[i] + if self.Vrep() is not None and names is True: + def f(size_t i): return self.Vrep()[i] else: def f(size_t i): return smallInteger(i) @@ -1113,8 +1113,8 @@ cdef class CombinatorialPolyhedron(SageObject): # with each array containing ``len_ridge_list`` of ridges. # Mapping the indices of the Vepr to the names, if requested. - if self.H() is not None and names is True: - def f(size_t i): return self.H()[i] + if self.facet_names() is not None and names is True: + def f(size_t i): return self.facet_names()[i] else: def f(size_t i): return smallInteger(i) @@ -1537,19 +1537,19 @@ cdef class CombinatorialPolyhedron(SageObject): # Let ``_all_faces`` determine Vrepresentation. return self._all_faces.get_face(dim, newindex) - cdef tuple V(self): + cdef tuple Vrep(self): r""" Return the names of the Vrepresentation, if they exist. Else return ``None``. """ - return self._V + return self._Vrep - cdef tuple H(self): + cdef tuple facet_names(self): r""" Return the names Hrepresentatives, which are facets. If not given, return ``None``. """ - return self._H + return self._facet_names cdef tuple equalities(self): r""" diff --git a/src/sage/geometry/polyhedron/combinatorial_polyhedron/combinatorial_face.pxd b/src/sage/geometry/polyhedron/combinatorial_polyhedron/combinatorial_face.pxd index aee12405708..ef5ea9c117c 100644 --- a/src/sage/geometry/polyhedron/combinatorial_polyhedron/combinatorial_face.pxd +++ b/src/sage/geometry/polyhedron/combinatorial_polyhedron/combinatorial_face.pxd @@ -17,9 +17,11 @@ cdef class CombinatorialFace(SageObject): cdef int _dimension # dimension of current face, dual dimension if ``dual`` cdef int _ambient_dimension # dimension of the polyhedron cdef size_t face_length # stores length of the faces in terms of uint64_t - cdef tuple _V, _H, _equalities # some copies from ``CombinatorialPolyhedron`` cdef size_t _hash_index # an index to give different hashes for all faces of a Polyhedron + # some copies from ``CombinatorialPolyhedron`` + cdef tuple _ambient_Vrep, _ambient_facets, _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 diff --git a/src/sage/geometry/polyhedron/combinatorial_polyhedron/combinatorial_face.pyx b/src/sage/geometry/polyhedron/combinatorial_polyhedron/combinatorial_face.pyx index 45b18d87360..6994a5f7195 100644 --- a/src/sage/geometry/polyhedron/combinatorial_polyhedron/combinatorial_face.pyx +++ b/src/sage/geometry/polyhedron/combinatorial_polyhedron/combinatorial_face.pyx @@ -173,8 +173,8 @@ cdef class CombinatorialFace(SageObject): self._dimension = it.current_dimension self._ambient_dimension = it.dimension self.face_length = it.face_length - self._V = it._V - self._H = it._H + self._ambient_Vrep = it._Vrep + self._ambient_facets = it._facet_names self._equalities = it._equalities self.atoms = it.atoms self.coatoms = it.coatoms @@ -196,8 +196,8 @@ cdef class CombinatorialFace(SageObject): self._dimension = dimension self._ambient_dimension = all_faces.dimension self.face_length = all_faces.face_length - self._V = all_faces._V - self._H = all_faces._H + self._ambient_Vrep = all_faces._Vrep + self._ambient_facets = all_faces._facet_names self._equalities = all_faces._equalities self.atoms = all_faces.atoms self.coatoms = all_faces.coatoms @@ -367,8 +367,8 @@ cdef class CombinatorialFace(SageObject): if self._dual: # if dual, the Vrepresenation corresponds to the coatom-representation length = self.set_coatom_repr() - if names and self._V: - return tuple(self._V[self.coatom_repr[i]] + if names and self._ambient_Vrep: + return tuple(self._ambient_Vrep[self.coatom_repr[i]] for i in range(length)) else: return tuple(smallInteger(self.coatom_repr[i]) @@ -376,8 +376,8 @@ cdef class CombinatorialFace(SageObject): else: # if not dual, the Vrepresenation corresponds to the atom-representation length = self.set_atom_repr() - if names and self._V: - return tuple(self._V[self.atom_repr[i]] + if names and self._ambient_Vrep: + return tuple(self._ambient_Vrep[self.atom_repr[i]] for i in range(length)) else: return tuple(smallInteger(self.atom_repr[i]) @@ -486,8 +486,8 @@ cdef class CombinatorialFace(SageObject): if not self._dual: # if not dual, the facet-represention corresponds to the coatom-representation length = self.set_coatom_repr() # fill self.coatom_repr_face - if names and self._H: - return tuple(self._H[self.coatom_repr[i]] + if names and self._ambient_facets: + return tuple(self._ambient_facets[self.coatom_repr[i]] for i in range(length)) + self._equalities else: return tuple(smallInteger(self.coatom_repr[i]) @@ -495,8 +495,8 @@ cdef class CombinatorialFace(SageObject): else: # if dual, the facet-represention corresponds to the atom-representation length = self.set_atom_repr() # fill self.atom_repr_face - if names and self._H: - return tuple(self._H[self.atom_repr[i]] + if names and self._ambient_facets: + return tuple(self._ambient_facets[self.atom_repr[i]] for i in range(length)) + self._equalities else: return tuple(smallInteger(self.atom_repr[i]) diff --git a/src/sage/geometry/polyhedron/combinatorial_polyhedron/face_iterator.pxd b/src/sage/geometry/polyhedron/combinatorial_polyhedron/face_iterator.pxd index dabb063942e..14e5253c98f 100644 --- a/src/sage/geometry/polyhedron/combinatorial_polyhedron/face_iterator.pxd +++ b/src/sage/geometry/polyhedron/combinatorial_polyhedron/face_iterator.pxd @@ -19,7 +19,9 @@ cdef class FaceIterator(SageObject): 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 - cdef tuple _V, _H, _equalities # some copies from ``CombinatorialPolyhedron`` + + # 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. diff --git a/src/sage/geometry/polyhedron/combinatorial_polyhedron/face_iterator.pyx b/src/sage/geometry/polyhedron/combinatorial_polyhedron/face_iterator.pyx index b1e074ec93b..2636111cca6 100644 --- a/src/sage/geometry/polyhedron/combinatorial_polyhedron/face_iterator.pyx +++ b/src/sage/geometry/polyhedron/combinatorial_polyhedron/face_iterator.pyx @@ -446,8 +446,8 @@ cdef class FaceIterator(SageObject): self.coatoms = C.bitrep_facets() self.atoms = C.bitrep_Vrepr() self.face_length = self.coatoms.face_length - self._V = C.V() - self._H = C.H() + self._Vrep = C.Vrep() + self._facet_names = C.facet_names() self._equalities = C.equalities() self.atom_repr = self._mem.allocarray(self.coatoms.n_atoms, sizeof(size_t)) diff --git a/src/sage/geometry/polyhedron/combinatorial_polyhedron/polyhedron_face_lattice.pxd b/src/sage/geometry/polyhedron/combinatorial_polyhedron/polyhedron_face_lattice.pxd index 12b85491a34..17c84df68e7 100644 --- a/src/sage/geometry/polyhedron/combinatorial_polyhedron/polyhedron_face_lattice.pxd +++ b/src/sage/geometry/polyhedron/combinatorial_polyhedron/polyhedron_face_lattice.pxd @@ -10,12 +10,14 @@ cdef class PolyhedronFaceLattice: cdef int dimension # dimension of Polyhedron cdef readonly bint dual # if True, then List of all faces by dual Polyhedron cdef size_t face_length # stores length of the faces in terms of uint64_t - cdef tuple _V, _H, _equalities # some copies from CombinatorialPolyhedron cdef size_t *f_vector # a copy of the f-vector, is reversed if dual cdef size_t *face_counter # how many faces of each dimension have been initialized cdef size_t *atom_repr # a place where atom-representaion of face will be stored cdef size_t *coatom_repr # a place where coatom-representaion of face will be stored + # some copies from CombinatorialPolyhedron + cdef tuple _Vrep, _facet_names, _equalities + # Atoms and coatoms are the Vrepr/facets of the Polyedron. # If ``dual == 0``, then coatoms are facets, atoms Vrepresentatives and vice versa. cdef ListOfFaces atoms, coatoms 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 2cac35e56a2..8256d4a2672 100644 --- a/src/sage/geometry/polyhedron/combinatorial_polyhedron/polyhedron_face_lattice.pyx +++ b/src/sage/geometry/polyhedron/combinatorial_polyhedron/polyhedron_face_lattice.pyx @@ -134,8 +134,8 @@ cdef class PolyhedronFaceLattice: self.dual = False cdef FaceIterator face_iter = C._face_iter(self.dual, -2) self.face_length = face_iter.face_length - self._V = C.V() - self._H = C.H() + self._Vrep = C.Vrep() + self._facet_names = C.facet_names() self._equalities = C.equalities() # copy f_vector for later use