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

Commit c698941

Browse files
author
Jonathan Kliem
committed
remove empty folder in combinatorial polyhedron
1 parent 10ed24e commit c698941

File tree

5 files changed

+142
-12
lines changed

5 files changed

+142
-12
lines changed

src/module_list.py

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -302,20 +302,28 @@ def uname_specific(name, value, alternative):
302302
sources = ['sage/geometry/polyhedron/combinatorial_polyhedron/base.pyx']),
303303

304304
Extension('sage.geometry.polyhedron.combinatorial_polyhedron.list_of_faces',
305-
sources = ['sage/geometry/polyhedron/combinatorial_polyhedron/list_of_faces.pyx']),
306-
307-
Extension('sage.geometry.polyhedron.combinatorial_polyhedron.bit_vector_operations.cc',
308-
sources = ['sage/geometry/polyhedron/combinatorial_polyhedron/bit_vector_operations.cc'],
305+
sources = ['sage/geometry/polyhedron/combinatorial_polyhedron/list_of_faces.pyx'],
306+
depends = ['sage/geometry/polyhedron/combinatorial_polyhedron/bit_vector_operations.cc'],
307+
language="c++",
309308
extra_compile_args=['-std=c++11']),
310309

311310
Extension('sage.geometry.polyhedron.combinatorial_polyhedron.face_iterator',
312-
sources = ['sage/geometry/polyhedron/combinatorial_polyhedron/face_iterator.pyx']),
311+
sources = ['sage/geometry/polyhedron/combinatorial_polyhedron/face_iterator.pyx'],
312+
depends = ['sage/geometry/polyhedron/combinatorial_polyhedron/bit_vector_operations.cc'],
313+
language="c++",
314+
extra_compile_args=['-std=c++11']),
313315

314316
Extension('sage.geometry.polyhedron.combinatorial_polyhedron.polyhedron_face_lattice',
315-
sources = ['sage/geometry/polyhedron/combinatorial_polyhedron/polyhedron_face_lattice.pyx']),
317+
sources = ['sage/geometry/polyhedron/combinatorial_polyhedron/polyhedron_face_lattice.pyx'],
318+
depends = ['sage/geometry/polyhedron/combinatorial_polyhedron/bit_vector_operations.cc'],
319+
language="c++",
320+
extra_compile_args=['-std=c++11']),
316321

317322
Extension('sage.geometry.polyhedron.combinatorial_polyhedron.combinatorial_face',
318-
sources = ['sage/geometry/polyhedron/combinatorial_polyhedron/combinatorial_face.pyx']),
323+
sources = ['sage/geometry/polyhedron/combinatorial_polyhedron/combinatorial_face.pyx'],
324+
depends = ['sage/geometry/polyhedron/combinatorial_polyhedron/bit_vector_operations.cc'],
325+
language="c++",
326+
extra_compile_args=['-std=c++11']),
319327

320328
Extension('sage.geometry.polyhedron.combinatorial_polyhedron.conversions',
321329
sources = ['sage/geometry/polyhedron/combinatorial_polyhedron/conversions.pyx']),

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

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,23 @@ import numbers
7070
from sage.rings.integer cimport smallInteger
7171
from .conversions cimport bit_rep_to_Vrep_list
7272
from .base cimport CombinatorialPolyhedron
73-
from .bit_vector_operations cimport count_atoms, bit_rep_to_coatom_rep
7473
from .polyhedron_face_lattice cimport PolyhedronFaceLattice
7574
from libc.string cimport memcpy
7675

76+
cdef extern from "bit_vector_operations.cc":
77+
cdef size_t count_atoms(uint64_t *A, size_t face_length)
78+
# Return the number of atoms/vertices in A.
79+
# This is the number of set bits in A.
80+
# ``face_length`` is the length of A in terms of uint64_t.
81+
82+
cdef size_t bit_rep_to_coatom_rep(
83+
uint64_t *face, uint64_t **coatoms, size_t n_coatoms,
84+
size_t face_length, size_t *output)
85+
# Write the coatom-representation of face in output. Return length.
86+
# ``face_length`` is the length of ``face`` and ``coatoms[i]``
87+
# in terms of uint64_t.
88+
# ``n_coatoms`` length of ``coatoms``.
89+
7790
cdef extern from "Python.h":
7891
int unlikely(int) nogil # Defined by Cython
7992

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

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,57 @@ from sage.rings.integer cimport smallInteger
161161
from cysignals.signals cimport sig_check, sig_on, sig_off
162162
from .conversions cimport bit_rep_to_Vrep_list
163163
from .base cimport CombinatorialPolyhedron
164-
from .bit_vector_operations cimport get_next_level, count_atoms, bit_rep_to_coatom_rep
164+
165+
cdef extern from "bit_vector_operations.cc":
166+
cdef size_t get_next_level(
167+
uint64_t **faces, const size_t n_faces, uint64_t **nextfaces,
168+
uint64_t **nextfaces2, uint64_t **visited_all,
169+
size_t n_visited_all, size_t face_length)
170+
# Set ``newfaces`` to be the facets of ``faces[n_faces -1]``
171+
# that are not contained in a face of ``visited_all``.
172+
173+
# INPUT:
174+
175+
# - ``maybe_newfaces`` -- quasi of type ``uint64_t[n_faces -1][face_length]``,
176+
# needs to be ``chunksize``-Bit aligned
177+
# - ``newfaces`` -- quasi of type ``*uint64_t[n_faces -1]
178+
# - ``visited_all`` -- quasi of type ``*uint64_t[n_visited_all]
179+
# - ``face_length`` -- length of the faces
180+
181+
# OUTPUT:
182+
183+
# - return number of ``newfaces``
184+
# - set ``newfaces`` to point to the new faces
185+
186+
# ALGORITHM:
187+
188+
# To get all facets of ``faces[n_faces-1]``, we would have to:
189+
# - Intersect the first ``n_faces-1`` faces of ``faces`` with the last face.
190+
# - Add all the intersection of ``visited_all`` with the last face
191+
# - Out of both the inclusion-maximal ones are of codimension 1, i.e. facets.
192+
193+
# As we have visited all faces of ``visited_all``, we alter the algorithm
194+
# to not revisit:
195+
# Step 1: Intersect the first ``n_faces-1`` faces of ``faces`` with the last face.
196+
# Step 2: Out of thosse the inclusion-maximal ones are some of the facets.
197+
# At least we obtain all of those, that we have not already visited.
198+
# Maybe, we get some more.
199+
# Step 3: Only keep those that we have not already visited.
200+
# We obtain exactly the facets of ``faces[n_faces-1]`` that we have
201+
# not visited yet.
202+
203+
cdef size_t count_atoms(uint64_t *A, size_t face_length)
204+
# Return the number of atoms/vertices in A.
205+
# This is the number of set bits in A.
206+
# ``face_length`` is the length of A in terms of uint64_t.
207+
208+
cdef size_t bit_rep_to_coatom_rep(
209+
uint64_t *face, uint64_t **coatoms, size_t n_coatoms,
210+
size_t face_length, size_t *output)
211+
# Write the coatom-representation of face in output. Return length.
212+
# ``face_length`` is the length of ``face`` and ``coatoms[i]``
213+
# in terms of uint64_t.
214+
# ``n_coatoms`` length of ``coatoms``.
165215

166216
cdef extern from "Python.h":
167217
int unlikely(int) nogil # Defined by Cython

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

Lines changed: 47 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ to bit-representations of vertices stored in :class:`ListOfFaces`.
1111
Moreover, :class:`ListOfFaces` calculates the dimension of a polyhedron, assuming the
1212
faces are the facets of this polyhedron.
1313
14-
Each face is stored over-aligned according to :meth:`~sage.geometry.polyhedron.combinatorial_polyhedron.bit_vector_operations.chunktype`.
14+
Each face is stored over-aligned according to the ``chunktype``.
1515
1616
.. SEEALSO::
1717
@@ -83,9 +83,54 @@ AUTHOR:
8383
from sage.structure.element import is_Matrix
8484

8585
from cysignals.signals cimport sig_on, sig_off
86-
from .bit_vector_operations cimport chunksize, get_next_level, count_atoms
8786
from libc.string cimport memcpy
8887

88+
cdef extern from "bit_vector_operations.cc":
89+
# Any Bit-representation is assumed to be `chunksize`-Bit aligned.
90+
cdef const size_t chunksize
91+
92+
cdef size_t get_next_level(
93+
uint64_t **faces, const size_t n_faces, uint64_t **nextfaces,
94+
uint64_t **nextfaces2, uint64_t **visited_all,
95+
size_t n_visited_all, size_t face_length)
96+
# Set ``newfaces`` to be the facets of ``faces[n_faces -1]``
97+
# that are not contained in a face of ``visited_all``.
98+
99+
# INPUT:
100+
101+
# - ``maybe_newfaces`` -- quasi of type ``uint64_t[n_faces -1][face_length]``,
102+
# needs to be ``chunksize``-Bit aligned
103+
# - ``newfaces`` -- quasi of type ``*uint64_t[n_faces -1]
104+
# - ``visited_all`` -- quasi of type ``*uint64_t[n_visited_all]
105+
# - ``face_length`` -- length of the faces
106+
107+
# OUTPUT:
108+
109+
# - return number of ``newfaces``
110+
# - set ``newfaces`` to point to the new faces
111+
112+
# ALGORITHM:
113+
114+
# To get all facets of ``faces[n_faces-1]``, we would have to:
115+
# - Intersect the first ``n_faces-1`` faces of ``faces`` with the last face.
116+
# - Add all the intersection of ``visited_all`` with the last face
117+
# - Out of both the inclusion-maximal ones are of codimension 1, i.e. facets.
118+
119+
# As we have visited all faces of ``visited_all``, we alter the algorithm
120+
# to not revisit:
121+
# Step 1: Intersect the first ``n_faces-1`` faces of ``faces`` with the last face.
122+
# Step 2: Out of thosse the inclusion-maximal ones are some of the facets.
123+
# At least we obtain all of those, that we have not already visited.
124+
# Maybe, we get some more.
125+
# Step 3: Only keep those that we have not already visited.
126+
# We obtain exactly the facets of ``faces[n_faces-1]`` that we have
127+
# not visited yet.
128+
129+
cdef size_t count_atoms(uint64_t *A, size_t face_length)
130+
# Return the number of atoms/vertices in A.
131+
# This is the number of set bits in A.
132+
# ``face_length`` is the length of A in terms of uint64_t.
133+
89134
cdef extern from "Python.h":
90135
int unlikely(int) nogil # Defined by Cython
91136

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

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,21 @@ from libc.string cimport memcmp, memcpy, memset
6868
from .conversions cimport Vrep_list_to_bit_rep, bit_rep_to_Vrep_list
6969
from .base cimport CombinatorialPolyhedron
7070
from .face_iterator cimport FaceIterator
71-
from .bit_vector_operations cimport intersection, bit_rep_to_coatom_rep
71+
72+
cdef extern from "bit_vector_operations.cc":
73+
cdef void intersection(uint64_t *A, uint64_t *B, uint64_t *C,
74+
size_t face_length)
75+
# Return ``A & ~B == 0``.
76+
# A is not subset of B, iff there is a vertex in A, which is not in B.
77+
# ``face_length`` is the length of A and B in terms of uint64_t.
78+
79+
cdef size_t bit_rep_to_coatom_rep(
80+
uint64_t *face, uint64_t **coatoms, size_t n_coatoms,
81+
size_t face_length, size_t *output)
82+
# Write the coatom-representation of face in output. Return length.
83+
# ``face_length`` is the length of ``face`` and ``coatoms[i]``
84+
# in terms of uint64_t.
85+
# ``n_coatoms`` length of ``coatoms``.
7286

7387
cdef extern from "Python.h":
7488
int unlikely(int) nogil # Defined by Cython

0 commit comments

Comments
 (0)