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

Commit

Permalink
remove empty folder in combinatorial polyhedron
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonathan Kliem committed Jan 31, 2020
1 parent 2cbd93e commit ae89a8b
Show file tree
Hide file tree
Showing 5 changed files with 142 additions and 12 deletions.
22 changes: 15 additions & 7 deletions src/module_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,20 +302,28 @@ def uname_specific(name, value, alternative):
sources = ['sage/geometry/polyhedron/combinatorial_polyhedron/base.pyx']),

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

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

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

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

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

Extension('sage.geometry.polyhedron.combinatorial_polyhedron.conversions',
sources = ['sage/geometry/polyhedron/combinatorial_polyhedron/conversions.pyx']),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,23 @@ import numbers
from sage.rings.integer cimport smallInteger
from .conversions cimport bit_repr_to_Vrepr_list
from .base cimport CombinatorialPolyhedron
from .bit_vector_operations cimport count_atoms, bit_repr_to_coatom_repr
from .polyhedron_face_lattice cimport PolyhedronFaceLattice
from libc.string cimport memcpy

cdef extern from "bit_vector_operations.cc":
cdef size_t count_atoms(uint64_t *A, size_t face_length)
# Return the number of atoms/vertices in A.
# This is the number of set bits in A.
# ``face_length`` is the length of A in terms of uint64_t.

cdef size_t bit_repr_to_coatom_repr(
uint64_t *face, uint64_t **coatoms, size_t n_coatoms,
size_t face_length, size_t *output)
# Write the coatom-representation of face in output. Return length.
# ``face_length`` is the length of ``face`` and ``coatoms[i]``
# in terms of uint64_t.
# ``n_coatoms`` length of ``coatoms``.

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,57 @@ from sage.rings.integer cimport smallInteger
from cysignals.signals cimport sig_check, sig_on, sig_off
from .conversions cimport bit_repr_to_Vrepr_list
from .base cimport CombinatorialPolyhedron
from .bit_vector_operations cimport get_next_level, count_atoms, bit_repr_to_coatom_repr

cdef extern from "bit_vector_operations.cc":
cdef size_t get_next_level(
uint64_t **faces, const size_t n_faces, uint64_t **nextfaces,
uint64_t **nextfaces2, uint64_t **visited_all,
size_t n_visited_all, size_t face_length)
# Set ``newfaces`` to be the facets of ``faces[n_faces -1]``
# that are not contained in a face of ``visited_all``.

# INPUT:

# - ``maybe_newfaces`` -- quasi of type ``uint64_t[n_faces -1][face_length]``,
# needs to be ``chunksize``-Bit aligned
# - ``newfaces`` -- quasi of type ``*uint64_t[n_faces -1]
# - ``visited_all`` -- quasi of type ``*uint64_t[n_visited_all]
# - ``face_length`` -- length of the faces

# OUTPUT:

# - return number of ``newfaces``
# - set ``newfaces`` to point to the new faces

# ALGORITHM:

# To get all facets of ``faces[n_faces-1]``, we would have to:
# - Intersect the first ``n_faces-1`` faces of ``faces`` with the last face.
# - Add all the intersection of ``visited_all`` with the last face
# - Out of both the inclusion-maximal ones are of codimension 1, i.e. facets.

# As we have visited all faces of ``visited_all``, we alter the algorithm
# to not revisit:
# Step 1: Intersect the first ``n_faces-1`` faces of ``faces`` with the last face.
# Step 2: Out of thosse the inclusion-maximal ones are some of the facets.
# At least we obtain all of those, that we have not already visited.
# Maybe, we get some more.
# Step 3: Only keep those that we have not already visited.
# We obtain exactly the facets of ``faces[n_faces-1]`` that we have
# not visited yet.

cdef size_t count_atoms(uint64_t *A, size_t face_length)
# Return the number of atoms/vertices in A.
# This is the number of set bits in A.
# ``face_length`` is the length of A in terms of uint64_t.

cdef size_t bit_repr_to_coatom_repr(
uint64_t *face, uint64_t **coatoms, size_t n_coatoms,
size_t face_length, size_t *output)
# Write the coatom-representation of face in output. Return length.
# ``face_length`` is the length of ``face`` and ``coatoms[i]``
# in terms of uint64_t.
# ``n_coatoms`` length of ``coatoms``.

cdef extern from "Python.h":
int unlikely(int) nogil # Defined by Cython
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ to bit-representations of vertices stored in :class:`ListOfFaces`.
Moreover, :class:`ListOfFaces` calculates the dimension of a polyhedron, assuming the
faces are the facets of this polyhedron.
Each face is stored over-aligned according to :meth:`~sage.geometry.polyhedron.combinatorial_polyhedron.bit_vector_operations.chunktype`.
Each face is stored over-aligned according to the ``chunktype``.
.. SEEALSO::
Expand Down Expand Up @@ -83,7 +83,52 @@ AUTHOR:
from sage.structure.element import is_Matrix

from cysignals.signals cimport sig_on, sig_off
from .bit_vector_operations cimport chunksize, get_next_level, count_atoms

cdef extern from "bit_vector_operations.cc":
# Any Bit-representation is assumed to be `chunksize`-Bit aligned.
cdef const size_t chunksize

cdef size_t get_next_level(
uint64_t **faces, const size_t n_faces, uint64_t **nextfaces,
uint64_t **nextfaces2, uint64_t **visited_all,
size_t n_visited_all, size_t face_length)
# Set ``newfaces`` to be the facets of ``faces[n_faces -1]``
# that are not contained in a face of ``visited_all``.

# INPUT:

# - ``maybe_newfaces`` -- quasi of type ``uint64_t[n_faces -1][face_length]``,
# needs to be ``chunksize``-Bit aligned
# - ``newfaces`` -- quasi of type ``*uint64_t[n_faces -1]
# - ``visited_all`` -- quasi of type ``*uint64_t[n_visited_all]
# - ``face_length`` -- length of the faces

# OUTPUT:

# - return number of ``newfaces``
# - set ``newfaces`` to point to the new faces

# ALGORITHM:

# To get all facets of ``faces[n_faces-1]``, we would have to:
# - Intersect the first ``n_faces-1`` faces of ``faces`` with the last face.
# - Add all the intersection of ``visited_all`` with the last face
# - Out of both the inclusion-maximal ones are of codimension 1, i.e. facets.

# As we have visited all faces of ``visited_all``, we alter the algorithm
# to not revisit:
# Step 1: Intersect the first ``n_faces-1`` faces of ``faces`` with the last face.
# Step 2: Out of thosse the inclusion-maximal ones are some of the facets.
# At least we obtain all of those, that we have not already visited.
# Maybe, we get some more.
# Step 3: Only keep those that we have not already visited.
# We obtain exactly the facets of ``faces[n_faces-1]`` that we have
# not visited yet.

cdef size_t count_atoms(uint64_t *A, size_t face_length)
# Return the number of atoms/vertices in A.
# This is the number of set bits in A.
# ``face_length`` is the length of A in terms of uint64_t.

cdef extern from "Python.h":
int unlikely(int) nogil # Defined by Cython
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,21 @@ from libc.string cimport memcmp, memcpy, memset
from .conversions cimport Vrepr_list_to_bit_repr, bit_repr_to_Vrepr_list
from .base cimport CombinatorialPolyhedron
from .face_iterator cimport FaceIterator
from .bit_vector_operations cimport intersection, bit_repr_to_coatom_repr

cdef extern from "bit_vector_operations.cc":
cdef void intersection(uint64_t *A, uint64_t *B, uint64_t *C,
size_t face_length)
# Return ``A & ~B == 0``.
# A is not subset of B, iff there is a vertex in A, which is not in B.
# ``face_length`` is the length of A and B in terms of uint64_t.

cdef size_t bit_repr_to_coatom_repr(
uint64_t *face, uint64_t **coatoms, size_t n_coatoms,
size_t face_length, size_t *output)
# Write the coatom-representation of face in output. Return length.
# ``face_length`` is the length of ``face`` and ``coatoms[i]``
# in terms of uint64_t.
# ``n_coatoms`` length of ``coatoms``.

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

0 comments on commit ae89a8b

Please sign in to comment.