passagemath-polyhedra 10.6.31rc3__cp314-cp314-musllinux_1_2_x86_64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of passagemath-polyhedra might be problematic. Click here for more details.
- passagemath_polyhedra-10.6.31rc3.dist-info/METADATA +367 -0
- passagemath_polyhedra-10.6.31rc3.dist-info/METADATA.bak +369 -0
- passagemath_polyhedra-10.6.31rc3.dist-info/RECORD +208 -0
- passagemath_polyhedra-10.6.31rc3.dist-info/WHEEL +5 -0
- passagemath_polyhedra-10.6.31rc3.dist-info/top_level.txt +2 -0
- passagemath_polyhedra.libs/libgcc_s-0cd532bd.so.1 +0 -0
- passagemath_polyhedra.libs/libgmp-0e7fc84e.so.10.5.0 +0 -0
- passagemath_polyhedra.libs/libgomp-8949ffbe.so.1.0.0 +0 -0
- passagemath_polyhedra.libs/libstdc++-5d72f927.so.6.0.33 +0 -0
- sage/all__sagemath_polyhedra.py +50 -0
- sage/game_theory/all.py +8 -0
- sage/game_theory/catalog.py +6 -0
- sage/game_theory/catalog_normal_form_games.py +923 -0
- sage/game_theory/cooperative_game.py +844 -0
- sage/game_theory/matching_game.py +1181 -0
- sage/game_theory/normal_form_game.py +2697 -0
- sage/game_theory/parser.py +275 -0
- sage/geometry/all__sagemath_polyhedra.py +22 -0
- sage/geometry/cone.py +6940 -0
- sage/geometry/cone_catalog.py +847 -0
- sage/geometry/cone_critical_angles.py +1027 -0
- sage/geometry/convex_set.py +1119 -0
- sage/geometry/fan.py +3743 -0
- sage/geometry/fan_isomorphism.py +389 -0
- sage/geometry/fan_morphism.py +1884 -0
- sage/geometry/hasse_diagram.py +202 -0
- sage/geometry/hyperplane_arrangement/affine_subspace.py +390 -0
- sage/geometry/hyperplane_arrangement/all.py +1 -0
- sage/geometry/hyperplane_arrangement/arrangement.py +3895 -0
- sage/geometry/hyperplane_arrangement/check_freeness.py +145 -0
- sage/geometry/hyperplane_arrangement/hyperplane.py +773 -0
- sage/geometry/hyperplane_arrangement/library.py +825 -0
- sage/geometry/hyperplane_arrangement/ordered_arrangement.py +642 -0
- sage/geometry/hyperplane_arrangement/plot.py +520 -0
- sage/geometry/integral_points.py +35 -0
- sage/geometry/integral_points_generic_dense.cpython-314-x86_64-linux-musl.so +0 -0
- sage/geometry/integral_points_generic_dense.pyx +7 -0
- sage/geometry/lattice_polytope.py +5894 -0
- sage/geometry/linear_expression.py +773 -0
- sage/geometry/newton_polygon.py +767 -0
- sage/geometry/point_collection.cpython-314-x86_64-linux-musl.so +0 -0
- sage/geometry/point_collection.pyx +1008 -0
- sage/geometry/polyhedral_complex.py +2616 -0
- sage/geometry/polyhedron/all.py +8 -0
- sage/geometry/polyhedron/backend_cdd.py +460 -0
- sage/geometry/polyhedron/backend_cdd_rdf.py +231 -0
- sage/geometry/polyhedron/backend_field.py +347 -0
- sage/geometry/polyhedron/backend_normaliz.py +2503 -0
- sage/geometry/polyhedron/backend_number_field.py +168 -0
- sage/geometry/polyhedron/backend_polymake.py +765 -0
- sage/geometry/polyhedron/backend_ppl.py +582 -0
- sage/geometry/polyhedron/base.py +1206 -0
- sage/geometry/polyhedron/base0.py +1444 -0
- sage/geometry/polyhedron/base1.py +886 -0
- sage/geometry/polyhedron/base2.py +812 -0
- sage/geometry/polyhedron/base3.py +1845 -0
- sage/geometry/polyhedron/base4.py +1262 -0
- sage/geometry/polyhedron/base5.py +2700 -0
- sage/geometry/polyhedron/base6.py +1741 -0
- sage/geometry/polyhedron/base7.py +997 -0
- sage/geometry/polyhedron/base_QQ.py +1258 -0
- sage/geometry/polyhedron/base_RDF.py +98 -0
- sage/geometry/polyhedron/base_ZZ.py +934 -0
- sage/geometry/polyhedron/base_mutable.py +215 -0
- sage/geometry/polyhedron/base_number_field.py +122 -0
- sage/geometry/polyhedron/cdd_file_format.py +155 -0
- sage/geometry/polyhedron/combinatorial_polyhedron/all.py +1 -0
- sage/geometry/polyhedron/combinatorial_polyhedron/base.cpython-314-x86_64-linux-musl.so +0 -0
- sage/geometry/polyhedron/combinatorial_polyhedron/base.pxd +76 -0
- sage/geometry/polyhedron/combinatorial_polyhedron/base.pyx +3859 -0
- sage/geometry/polyhedron/combinatorial_polyhedron/combinatorial_face.cpython-314-x86_64-linux-musl.so +0 -0
- sage/geometry/polyhedron/combinatorial_polyhedron/combinatorial_face.pxd +39 -0
- sage/geometry/polyhedron/combinatorial_polyhedron/combinatorial_face.pyx +1038 -0
- sage/geometry/polyhedron/combinatorial_polyhedron/conversions.cpython-314-x86_64-linux-musl.so +0 -0
- sage/geometry/polyhedron/combinatorial_polyhedron/conversions.pxd +9 -0
- sage/geometry/polyhedron/combinatorial_polyhedron/conversions.pyx +501 -0
- sage/geometry/polyhedron/combinatorial_polyhedron/face_data_structure.pxd +207 -0
- sage/geometry/polyhedron/combinatorial_polyhedron/face_iterator.cpython-314-x86_64-linux-musl.so +0 -0
- sage/geometry/polyhedron/combinatorial_polyhedron/face_iterator.pxd +102 -0
- sage/geometry/polyhedron/combinatorial_polyhedron/face_iterator.pyx +2274 -0
- sage/geometry/polyhedron/combinatorial_polyhedron/face_list_data_structure.cpython-314-x86_64-linux-musl.so +0 -0
- sage/geometry/polyhedron/combinatorial_polyhedron/face_list_data_structure.pxd +370 -0
- sage/geometry/polyhedron/combinatorial_polyhedron/face_list_data_structure.pyx +84 -0
- sage/geometry/polyhedron/combinatorial_polyhedron/list_of_faces.cpython-314-x86_64-linux-musl.so +0 -0
- sage/geometry/polyhedron/combinatorial_polyhedron/list_of_faces.pxd +31 -0
- sage/geometry/polyhedron/combinatorial_polyhedron/list_of_faces.pyx +587 -0
- sage/geometry/polyhedron/combinatorial_polyhedron/polyhedron_face_lattice.cpython-314-x86_64-linux-musl.so +0 -0
- sage/geometry/polyhedron/combinatorial_polyhedron/polyhedron_face_lattice.pxd +52 -0
- sage/geometry/polyhedron/combinatorial_polyhedron/polyhedron_face_lattice.pyx +560 -0
- sage/geometry/polyhedron/constructor.py +773 -0
- sage/geometry/polyhedron/double_description.py +753 -0
- sage/geometry/polyhedron/double_description_inhomogeneous.py +564 -0
- sage/geometry/polyhedron/face.py +1060 -0
- sage/geometry/polyhedron/generating_function.py +1810 -0
- sage/geometry/polyhedron/lattice_euclidean_group_element.py +178 -0
- sage/geometry/polyhedron/library.py +3502 -0
- sage/geometry/polyhedron/misc.py +121 -0
- sage/geometry/polyhedron/modules/all.py +1 -0
- sage/geometry/polyhedron/modules/formal_polyhedra_module.py +155 -0
- sage/geometry/polyhedron/palp_database.py +447 -0
- sage/geometry/polyhedron/parent.py +1279 -0
- sage/geometry/polyhedron/plot.py +1986 -0
- sage/geometry/polyhedron/ppl_lattice_polygon.py +556 -0
- sage/geometry/polyhedron/ppl_lattice_polytope.py +1257 -0
- sage/geometry/polyhedron/representation.py +1723 -0
- sage/geometry/pseudolines.py +515 -0
- sage/geometry/relative_interior.py +445 -0
- sage/geometry/toric_plotter.py +1103 -0
- sage/geometry/triangulation/all.py +2 -0
- sage/geometry/triangulation/base.cpython-314-x86_64-linux-musl.so +0 -0
- sage/geometry/triangulation/base.pyx +963 -0
- sage/geometry/triangulation/data.h +147 -0
- sage/geometry/triangulation/data.pxd +4 -0
- sage/geometry/triangulation/element.py +914 -0
- sage/geometry/triangulation/functions.h +10 -0
- sage/geometry/triangulation/functions.pxd +4 -0
- sage/geometry/triangulation/point_configuration.py +2256 -0
- sage/geometry/triangulation/triangulations.h +49 -0
- sage/geometry/triangulation/triangulations.pxd +7 -0
- sage/geometry/voronoi_diagram.py +319 -0
- sage/interfaces/all__sagemath_polyhedra.py +1 -0
- sage/interfaces/polymake.py +2028 -0
- sage/numerical/all.py +13 -0
- sage/numerical/all__sagemath_polyhedra.py +11 -0
- sage/numerical/backends/all.py +1 -0
- sage/numerical/backends/all__sagemath_polyhedra.py +1 -0
- sage/numerical/backends/cvxopt_backend.cpython-314-x86_64-linux-musl.so +0 -0
- sage/numerical/backends/cvxopt_backend.pyx +1006 -0
- sage/numerical/backends/cvxopt_backend_test.py +19 -0
- sage/numerical/backends/cvxopt_sdp_backend.cpython-314-x86_64-linux-musl.so +0 -0
- sage/numerical/backends/cvxopt_sdp_backend.pyx +382 -0
- sage/numerical/backends/cvxpy_backend.cpython-314-x86_64-linux-musl.so +0 -0
- sage/numerical/backends/cvxpy_backend.pxd +41 -0
- sage/numerical/backends/cvxpy_backend.pyx +934 -0
- sage/numerical/backends/cvxpy_backend_test.py +13 -0
- sage/numerical/backends/generic_backend_test.py +24 -0
- sage/numerical/backends/interactivelp_backend.cpython-314-x86_64-linux-musl.so +0 -0
- sage/numerical/backends/interactivelp_backend.pxd +36 -0
- sage/numerical/backends/interactivelp_backend.pyx +1231 -0
- sage/numerical/backends/interactivelp_backend_test.py +12 -0
- sage/numerical/backends/logging_backend.py +391 -0
- sage/numerical/backends/matrix_sdp_backend.cpython-314-x86_64-linux-musl.so +0 -0
- sage/numerical/backends/matrix_sdp_backend.pxd +15 -0
- sage/numerical/backends/matrix_sdp_backend.pyx +478 -0
- sage/numerical/backends/ppl_backend.cpython-314-x86_64-linux-musl.so +0 -0
- sage/numerical/backends/ppl_backend.pyx +1126 -0
- sage/numerical/backends/ppl_backend_test.py +13 -0
- sage/numerical/backends/scip_backend.cpython-314-x86_64-linux-musl.so +0 -0
- sage/numerical/backends/scip_backend.pxd +22 -0
- sage/numerical/backends/scip_backend.pyx +1289 -0
- sage/numerical/backends/scip_backend_test.py +13 -0
- sage/numerical/interactive_simplex_method.py +5338 -0
- sage/numerical/knapsack.py +665 -0
- sage/numerical/linear_functions.cpython-314-x86_64-linux-musl.so +0 -0
- sage/numerical/linear_functions.pxd +31 -0
- sage/numerical/linear_functions.pyx +1648 -0
- sage/numerical/linear_tensor.py +470 -0
- sage/numerical/linear_tensor_constraints.py +448 -0
- sage/numerical/linear_tensor_element.cpython-314-x86_64-linux-musl.so +0 -0
- sage/numerical/linear_tensor_element.pxd +6 -0
- sage/numerical/linear_tensor_element.pyx +459 -0
- sage/numerical/mip.cpython-314-x86_64-linux-musl.so +0 -0
- sage/numerical/mip.pxd +40 -0
- sage/numerical/mip.pyx +3667 -0
- sage/numerical/sdp.cpython-314-x86_64-linux-musl.so +0 -0
- sage/numerical/sdp.pxd +39 -0
- sage/numerical/sdp.pyx +1433 -0
- sage/rings/all__sagemath_polyhedra.py +3 -0
- sage/rings/polynomial/all__sagemath_polyhedra.py +10 -0
- sage/rings/polynomial/omega.py +982 -0
- sage/schemes/all__sagemath_polyhedra.py +2 -0
- sage/schemes/toric/all.py +10 -0
- sage/schemes/toric/chow_group.py +1248 -0
- sage/schemes/toric/divisor.py +2082 -0
- sage/schemes/toric/divisor_class.cpython-314-x86_64-linux-musl.so +0 -0
- sage/schemes/toric/divisor_class.pyx +322 -0
- sage/schemes/toric/fano_variety.py +1606 -0
- sage/schemes/toric/homset.py +650 -0
- sage/schemes/toric/ideal.py +451 -0
- sage/schemes/toric/library.py +1322 -0
- sage/schemes/toric/morphism.py +1958 -0
- sage/schemes/toric/points.py +1032 -0
- sage/schemes/toric/sheaf/all.py +1 -0
- sage/schemes/toric/sheaf/constructor.py +302 -0
- sage/schemes/toric/sheaf/klyachko.py +921 -0
- sage/schemes/toric/toric_subscheme.py +905 -0
- sage/schemes/toric/variety.py +3460 -0
- sage/schemes/toric/weierstrass.py +1078 -0
- sage/schemes/toric/weierstrass_covering.py +457 -0
- sage/schemes/toric/weierstrass_higher.py +288 -0
- sage_wheels/share/reflexive_polytopes/Full2d/zzdb.info +10 -0
- sage_wheels/share/reflexive_polytopes/Full2d/zzdb.v03 +0 -0
- sage_wheels/share/reflexive_polytopes/Full2d/zzdb.v04 +0 -0
- sage_wheels/share/reflexive_polytopes/Full2d/zzdb.v05 +1 -0
- sage_wheels/share/reflexive_polytopes/Full2d/zzdb.v06 +1 -0
- sage_wheels/share/reflexive_polytopes/Full3d/zzdb.info +22 -0
- sage_wheels/share/reflexive_polytopes/Full3d/zzdb.v04 +0 -0
- sage_wheels/share/reflexive_polytopes/Full3d/zzdb.v05 +0 -0
- sage_wheels/share/reflexive_polytopes/Full3d/zzdb.v06 +0 -0
- sage_wheels/share/reflexive_polytopes/Full3d/zzdb.v07 +0 -0
- sage_wheels/share/reflexive_polytopes/Full3d/zzdb.v08 +0 -0
- sage_wheels/share/reflexive_polytopes/Full3d/zzdb.v09 +0 -0
- sage_wheels/share/reflexive_polytopes/Full3d/zzdb.v10 +0 -0
- sage_wheels/share/reflexive_polytopes/Full3d/zzdb.v11 +1 -0
- sage_wheels/share/reflexive_polytopes/Full3d/zzdb.v12 +1 -0
- sage_wheels/share/reflexive_polytopes/Full3d/zzdb.v13 +1 -0
- sage_wheels/share/reflexive_polytopes/reflexive_polytopes_2d +80 -0
- sage_wheels/share/reflexive_polytopes/reflexive_polytopes_3d +37977 -0
|
Binary file
|
|
@@ -0,0 +1,370 @@
|
|
|
1
|
+
# sage_setup: distribution = sagemath-polyhedra
|
|
2
|
+
"""
|
|
3
|
+
Inline cython methods for lists of faces.
|
|
4
|
+
"""
|
|
5
|
+
# ****************************************************************************
|
|
6
|
+
# Copyright (C) 2020 Jonathan Kliem <jonathan.kliem@gmail.com>
|
|
7
|
+
#
|
|
8
|
+
# This program is free software: you can redistribute it and/or modify
|
|
9
|
+
# it under the terms of the GNU General Public License as published by
|
|
10
|
+
# the Free Software Foundation, either version 2 of the License, or
|
|
11
|
+
# (at your option) any later version.
|
|
12
|
+
# https://www.gnu.org/licenses/
|
|
13
|
+
# ****************************************************************************
|
|
14
|
+
|
|
15
|
+
cdef extern from "Python.h":
|
|
16
|
+
int unlikely(int) nogil # Defined by Cython
|
|
17
|
+
|
|
18
|
+
from sage.geometry.polyhedron.combinatorial_polyhedron.face_data_structure cimport *
|
|
19
|
+
from libc.string cimport memset
|
|
20
|
+
from cysignals.signals cimport sig_check
|
|
21
|
+
from cysignals.memory cimport check_allocarray, check_calloc, sig_free
|
|
22
|
+
|
|
23
|
+
cdef struct face_list_s:
|
|
24
|
+
face_t* faces
|
|
25
|
+
size_t n_faces
|
|
26
|
+
size_t total_n_faces
|
|
27
|
+
size_t n_atoms
|
|
28
|
+
size_t n_coatoms
|
|
29
|
+
bint polyhedron_is_simple
|
|
30
|
+
bint* is_not_new_face
|
|
31
|
+
|
|
32
|
+
ctypedef face_list_s face_list_t[1]
|
|
33
|
+
|
|
34
|
+
#############################################################################
|
|
35
|
+
# Face List Initialization
|
|
36
|
+
#############################################################################
|
|
37
|
+
|
|
38
|
+
cdef inline int face_list_init(face_list_t faces, size_t n_faces, size_t n_atoms, size_t n_coatoms) except -1:
|
|
39
|
+
"""
|
|
40
|
+
Set the initial values for a list of faces with given number of faces
|
|
41
|
+
and number of atoms.
|
|
42
|
+
"""
|
|
43
|
+
face_list_shallow_init(faces, n_faces, n_atoms, n_coatoms)
|
|
44
|
+
cdef size_t i
|
|
45
|
+
for i in range(n_faces):
|
|
46
|
+
face_init(faces.faces[i], n_atoms, n_coatoms)
|
|
47
|
+
|
|
48
|
+
cdef inline int face_list_shallow_init(face_list_t faces, size_t n_faces, size_t n_atoms, size_t n_coatoms) except -1:
|
|
49
|
+
"""
|
|
50
|
+
Initialize ``faces`` completely, but only set up memory for the pointers to the faces.
|
|
51
|
+
"""
|
|
52
|
+
faces.n_faces = n_faces
|
|
53
|
+
faces.total_n_faces = n_faces
|
|
54
|
+
faces.n_atoms = n_atoms
|
|
55
|
+
faces.n_coatoms = n_coatoms
|
|
56
|
+
faces.faces = <face_t *> check_calloc(n_faces, sizeof(face_t))
|
|
57
|
+
faces.is_not_new_face = <bint *> check_allocarray(n_faces, sizeof(bint))
|
|
58
|
+
faces.polyhedron_is_simple = False
|
|
59
|
+
|
|
60
|
+
cdef inline void face_list_free(face_list_t faces) noexcept:
|
|
61
|
+
"""
|
|
62
|
+
Free faces.
|
|
63
|
+
"""
|
|
64
|
+
cdef size_t i
|
|
65
|
+
if faces.faces is not NULL:
|
|
66
|
+
for i in range(faces.total_n_faces):
|
|
67
|
+
face_free(faces.faces[i])
|
|
68
|
+
face_list_shallow_free(faces)
|
|
69
|
+
|
|
70
|
+
cdef inline void face_list_shallow_free(face_list_t faces) noexcept:
|
|
71
|
+
"""
|
|
72
|
+
Free a shallow list of faces.
|
|
73
|
+
"""
|
|
74
|
+
sig_free(faces.faces)
|
|
75
|
+
sig_free(faces.is_not_new_face)
|
|
76
|
+
|
|
77
|
+
cdef inline int face_list_copy(face_list_t dst, face_list_t src) except -1:
|
|
78
|
+
"""
|
|
79
|
+
This is a deep copy. All the data for the faces is copied.
|
|
80
|
+
|
|
81
|
+
Asserts that ``dst`` is allocated and fits everything.
|
|
82
|
+
"""
|
|
83
|
+
assert dst.total_n_faces >= src.n_faces
|
|
84
|
+
assert dst.n_atoms >= src.n_atoms
|
|
85
|
+
assert dst.n_coatoms >= src.n_coatoms
|
|
86
|
+
|
|
87
|
+
dst.n_faces = src.n_faces
|
|
88
|
+
dst.polyhedron_is_simple = src.polyhedron_is_simple
|
|
89
|
+
|
|
90
|
+
cdef size_t i
|
|
91
|
+
for i in range(src.n_faces):
|
|
92
|
+
face_copy(dst.faces[i], src.faces[i])
|
|
93
|
+
|
|
94
|
+
cdef inline int face_list_shallow_copy(face_list_t dst, face_list_t src) except -1:
|
|
95
|
+
"""
|
|
96
|
+
Copy the pointers to the faces.
|
|
97
|
+
|
|
98
|
+
Asserts that ``dst`` contains enough space for the pointers.
|
|
99
|
+
"""
|
|
100
|
+
assert dst.total_n_faces >= src.n_faces
|
|
101
|
+
dst.n_atoms = src.n_atoms
|
|
102
|
+
dst.n_coatoms = src.n_coatoms
|
|
103
|
+
dst.polyhedron_is_simple = src.polyhedron_is_simple
|
|
104
|
+
dst.n_faces = src.n_faces
|
|
105
|
+
|
|
106
|
+
cdef size_t i
|
|
107
|
+
for i in range(src.n_faces):
|
|
108
|
+
dst.faces[i][0] = src.faces[i][0]
|
|
109
|
+
|
|
110
|
+
cdef inline int add_face_shallow(face_list_t faces, face_t face) except -1 nogil:
|
|
111
|
+
"""
|
|
112
|
+
Add a face to faces.
|
|
113
|
+
"""
|
|
114
|
+
if unlikely(not faces.total_n_faces >= faces.n_faces + 1):
|
|
115
|
+
# Actually raising an error here results in a bad branch prediction.
|
|
116
|
+
return -1
|
|
117
|
+
faces.faces[faces.n_faces][0] = face[0]
|
|
118
|
+
faces.n_faces += 1
|
|
119
|
+
|
|
120
|
+
cdef inline int add_face_deep(face_list_t faces, face_t face) except -1:
|
|
121
|
+
"""
|
|
122
|
+
Add a face to faces.
|
|
123
|
+
"""
|
|
124
|
+
assert faces.total_n_faces >= faces.n_faces + 1
|
|
125
|
+
face_copy(faces.faces[faces.n_faces], face)
|
|
126
|
+
faces.n_faces += 1
|
|
127
|
+
|
|
128
|
+
cdef inline void face_list_delete_faces_by_array(face_list_t faces, bint *delete) noexcept:
|
|
129
|
+
r"""
|
|
130
|
+
Remove face ``i`` if and only if ``delete[i]`` decreasing ``faces.n_faces``.
|
|
131
|
+
|
|
132
|
+
.. WARNING::
|
|
133
|
+
|
|
134
|
+
``delete`` is assumed to be of length ``faces.n_faces``.
|
|
135
|
+
"""
|
|
136
|
+
cdef size_t n_newfaces = 0
|
|
137
|
+
cdef size_t i
|
|
138
|
+
for i in range(faces.n_faces):
|
|
139
|
+
if not delete[i]:
|
|
140
|
+
faces.faces[n_newfaces][0] = faces.faces[i][0]
|
|
141
|
+
n_newfaces += 1
|
|
142
|
+
else:
|
|
143
|
+
face_free(faces.faces[i])
|
|
144
|
+
|
|
145
|
+
faces.n_faces = n_newfaces
|
|
146
|
+
faces.total_n_faces = n_newfaces
|
|
147
|
+
|
|
148
|
+
cdef inline void face_list_delete_faces_by_face(face_list_t faces, face_t face) noexcept:
|
|
149
|
+
r"""
|
|
150
|
+
Remove all faces such that the ``i``-th bit in ``face`` is not set
|
|
151
|
+
decreasing ``faces.n_faces``.
|
|
152
|
+
|
|
153
|
+
.. WARNING::
|
|
154
|
+
|
|
155
|
+
``face`` is assumed to contain ``self.n_faces`` atoms.
|
|
156
|
+
"""
|
|
157
|
+
cdef size_t n_newfaces = 0
|
|
158
|
+
cdef size_t i
|
|
159
|
+
for i in range(faces.n_faces):
|
|
160
|
+
if face_atom_in(face, i):
|
|
161
|
+
faces.faces[n_newfaces][0] = faces.faces[i][0]
|
|
162
|
+
n_newfaces += 1
|
|
163
|
+
else:
|
|
164
|
+
face_free(faces.faces[i])
|
|
165
|
+
|
|
166
|
+
faces.n_faces = n_newfaces
|
|
167
|
+
faces.total_n_faces = n_newfaces
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
#############################################################################
|
|
171
|
+
# Face Comparison
|
|
172
|
+
#############################################################################
|
|
173
|
+
|
|
174
|
+
cdef void sort_faces_list(face_list_t faces) noexcept
|
|
175
|
+
|
|
176
|
+
cdef inline size_t find_face(face_t face, face_list_t faces) noexcept:
|
|
177
|
+
r"""
|
|
178
|
+
Return the index of ``face`` in ``faces``.
|
|
179
|
+
|
|
180
|
+
Return ``-1`` if the ``face`` is not contained.
|
|
181
|
+
|
|
182
|
+
.. NOTE::
|
|
183
|
+
|
|
184
|
+
Assumes that ``faces`` are sorted.
|
|
185
|
+
"""
|
|
186
|
+
cdef size_t start = 0
|
|
187
|
+
cdef size_t middle
|
|
188
|
+
cdef size_t n_faces = faces.n_faces
|
|
189
|
+
cdef face_t* faces_pt = faces.faces
|
|
190
|
+
cdef int val
|
|
191
|
+
|
|
192
|
+
while (n_faces > 1):
|
|
193
|
+
# In each iteration step, we will look for ``face`` in
|
|
194
|
+
# ``faces_pt[start:start+n_faces]``.
|
|
195
|
+
middle = n_faces//2
|
|
196
|
+
val = face_cmp(face, faces_pt[middle + start])
|
|
197
|
+
if val < 0:
|
|
198
|
+
# If face is in the list, then in the lower half.
|
|
199
|
+
# Look for face in ``faces[start : start + middle]`` in next step.
|
|
200
|
+
n_faces = middle
|
|
201
|
+
elif val > 0:
|
|
202
|
+
# If face is in the list, then in the upper half.
|
|
203
|
+
# Look for face in ``faces[start+middle:start+n_faces]``, i.e.
|
|
204
|
+
# ``faces[start + middle : (start + middle) + n_faces - middle]``.
|
|
205
|
+
n_faces -= middle
|
|
206
|
+
start += middle
|
|
207
|
+
else:
|
|
208
|
+
return middle + start
|
|
209
|
+
if face_cmp(face, faces_pt[start]) == 0:
|
|
210
|
+
return start
|
|
211
|
+
else:
|
|
212
|
+
return -1
|
|
213
|
+
|
|
214
|
+
cdef inline bint is_contained_in_one_fused(face_t face, face_list_t faces, algorithm_variant algorithm) noexcept nogil:
|
|
215
|
+
"""
|
|
216
|
+
Return whether ``face`` is contained in one of ``faces``.
|
|
217
|
+
"""
|
|
218
|
+
cdef size_t i
|
|
219
|
+
for i in range(faces.n_faces):
|
|
220
|
+
if face_issubset_fused(face, faces.faces[i], algorithm):
|
|
221
|
+
return True
|
|
222
|
+
return False
|
|
223
|
+
|
|
224
|
+
cdef inline bint is_not_maximal_fused(face_list_t faces, size_t j, algorithm_variant algorithm, bint* is_not_new_face) noexcept nogil:
|
|
225
|
+
"""
|
|
226
|
+
Return whether face ``j`` is not maximal in ``faces``.
|
|
227
|
+
"""
|
|
228
|
+
cdef size_t i
|
|
229
|
+
if algorithm_variant is standard:
|
|
230
|
+
for i in range(j):
|
|
231
|
+
if (not is_not_new_face[i]) and face_issubset_fused(faces.faces[j], faces.faces[i], algorithm):
|
|
232
|
+
# It suffices to check those faces, that are maximal.
|
|
233
|
+
# This way, if multiple identical faces are maximal,
|
|
234
|
+
# exactly the last one is considered maximal.
|
|
235
|
+
return True
|
|
236
|
+
for i in range(j+1, faces.n_faces):
|
|
237
|
+
if face_issubset_fused(faces.faces[j], faces.faces[i], algorithm):
|
|
238
|
+
return True
|
|
239
|
+
return False
|
|
240
|
+
else:
|
|
241
|
+
# For simple polytopes an intersection of facets is of codimension 2,
|
|
242
|
+
# if and only if it contains a coatom.
|
|
243
|
+
return face_isempty(faces.faces[j])
|
|
244
|
+
|
|
245
|
+
#############################################################################
|
|
246
|
+
# Arithmetic
|
|
247
|
+
#############################################################################
|
|
248
|
+
|
|
249
|
+
cdef inline int face_list_intersection_fused(face_list_t dest, face_list_t A, face_t b, algorithm_variant algorithm) except -1 nogil:
|
|
250
|
+
"""
|
|
251
|
+
Set ``dest`` to be the intersection of each face of ``A`` with ``b``.
|
|
252
|
+
"""
|
|
253
|
+
if unlikely(not dest.total_n_faces >= A.n_faces):
|
|
254
|
+
# Actually raising an error here results in a bad branch prediction.
|
|
255
|
+
return -1
|
|
256
|
+
if unlikely(not dest.n_atoms >= A.n_atoms):
|
|
257
|
+
# Actually raising an error here results in a bad branch prediction.
|
|
258
|
+
return -1
|
|
259
|
+
dest.n_faces = A.n_faces
|
|
260
|
+
dest.polyhedron_is_simple = A.polyhedron_is_simple
|
|
261
|
+
|
|
262
|
+
cdef size_t i
|
|
263
|
+
for i in range(A.n_faces):
|
|
264
|
+
face_intersection_fused(dest.faces[i], A.faces[i], b, algorithm)
|
|
265
|
+
|
|
266
|
+
|
|
267
|
+
cdef inline size_t get_next_level_fused(
|
|
268
|
+
face_list_t faces,
|
|
269
|
+
face_list_t new_faces,
|
|
270
|
+
face_list_t visited_all, algorithm_variant algorithm) except -1 nogil:
|
|
271
|
+
"""
|
|
272
|
+
Set ``new_faces`` to be the facets of ``faces.faces[face.n_faces-1]``
|
|
273
|
+
that are not contained in a face of ``visited_all``.
|
|
274
|
+
|
|
275
|
+
Reduce the number of faces in ``faces`` by one.
|
|
276
|
+
|
|
277
|
+
INPUT:
|
|
278
|
+
|
|
279
|
+
- ``faces`` -- containing at least one face
|
|
280
|
+
- ``new_faces`` -- needs to be of same size as ``faces``
|
|
281
|
+
- ``visited_all`` -- the faces which have been visited before
|
|
282
|
+
|
|
283
|
+
OUTPUT: set ``new_faces`` to point to the new faces
|
|
284
|
+
|
|
285
|
+
ALGORITHM:
|
|
286
|
+
|
|
287
|
+
To get all facets of ``faces.faces[faces.n_faces-1]``, we would have to:
|
|
288
|
+
- Intersect the first ``n_faces-1`` faces of ``faces`` with the last face.
|
|
289
|
+
- Add all the intersection of ``visited_all`` with the last face
|
|
290
|
+
- Out of both the inclusion-maximal ones are of codimension one, i.e. facets.
|
|
291
|
+
|
|
292
|
+
As we have visited all faces of ``visited_all``, we alter the algorithm
|
|
293
|
+
to not revisit:
|
|
294
|
+
Step 1: Intersect the first ``n_faces-1`` faces of ``faces`` with the last face.
|
|
295
|
+
Step 2: Out of those the inclusion-maximal ones are some of the facets.
|
|
296
|
+
At least we obtain all of those, that we have not already visited.
|
|
297
|
+
Maybe, we get some more.
|
|
298
|
+
Step 3: Only keep those that we have not already visited.
|
|
299
|
+
We obtain exactly the facets of ``faces[n_faces-1]`` that we have
|
|
300
|
+
not visited yet.
|
|
301
|
+
"""
|
|
302
|
+
# We keep track, which face in ``new_faces`` is a new face.
|
|
303
|
+
cdef size_t n_faces = faces.n_faces
|
|
304
|
+
cdef bint* is_not_new_face = new_faces.is_not_new_face
|
|
305
|
+
memset(is_not_new_face, 0, n_faces*sizeof(bint))
|
|
306
|
+
|
|
307
|
+
# Step 1:
|
|
308
|
+
n_faces -= 1
|
|
309
|
+
faces.n_faces -= 1
|
|
310
|
+
face_list_intersection_fused(new_faces, faces, faces.faces[n_faces], algorithm)
|
|
311
|
+
|
|
312
|
+
cdef size_t j
|
|
313
|
+
for j in range(n_faces):
|
|
314
|
+
sig_check()
|
|
315
|
+
if (is_not_maximal_fused(new_faces, j, algorithm, is_not_new_face) or # Step 2
|
|
316
|
+
is_contained_in_one_fused(new_faces.faces[j], visited_all, algorithm)): # Step 3
|
|
317
|
+
is_not_new_face[j] = True
|
|
318
|
+
|
|
319
|
+
# Set ``new_faces`` to point to the correct ones.
|
|
320
|
+
cdef size_t n_new_faces = 0
|
|
321
|
+
for j in range(n_faces):
|
|
322
|
+
if is_not_new_face[j]:
|
|
323
|
+
continue
|
|
324
|
+
# It is a new face of codimension 1.
|
|
325
|
+
# Either ``faces.n_new_faces == j`` or ``new_faces.faces[n_new_faces]`` is not
|
|
326
|
+
# a new face.
|
|
327
|
+
|
|
328
|
+
swap_faces(new_faces.faces[j], new_faces.faces[n_new_faces])
|
|
329
|
+
|
|
330
|
+
n_new_faces += 1
|
|
331
|
+
|
|
332
|
+
new_faces.n_faces = n_new_faces
|
|
333
|
+
return n_new_faces
|
|
334
|
+
|
|
335
|
+
cdef inline size_t get_next_level(
|
|
336
|
+
face_list_t faces,
|
|
337
|
+
face_list_t new_faces,
|
|
338
|
+
face_list_t visited_all) except -1 nogil:
|
|
339
|
+
|
|
340
|
+
cdef size_t output
|
|
341
|
+
if faces.polyhedron_is_simple:
|
|
342
|
+
output = get_next_level_fused(faces, new_faces, visited_all, <simple> 0)
|
|
343
|
+
else:
|
|
344
|
+
output = get_next_level_fused(faces, new_faces, visited_all, <standard> 0)
|
|
345
|
+
return output
|
|
346
|
+
|
|
347
|
+
cdef inline size_t bit_rep_to_coatom_rep(face_t face, face_list_t coatoms, size_t *output) noexcept:
|
|
348
|
+
"""
|
|
349
|
+
Write the coatom-representation of face in output. Return length.
|
|
350
|
+
``face_length`` is the length of ``face`` and ``coatoms[i]``
|
|
351
|
+
in terms of uint64_t.
|
|
352
|
+
``n_coatoms`` length of ``coatoms``.
|
|
353
|
+
"""
|
|
354
|
+
cdef size_t count_length = 0
|
|
355
|
+
cdef size_t i
|
|
356
|
+
for i in range(coatoms.n_faces):
|
|
357
|
+
if face_issubset(face, coatoms.faces[i]):
|
|
358
|
+
output[count_length] = i
|
|
359
|
+
count_length += 1
|
|
360
|
+
return count_length
|
|
361
|
+
|
|
362
|
+
cdef inline bint face_list_check_alignment(face_list_t faces) noexcept:
|
|
363
|
+
"""
|
|
364
|
+
Return whether all faces in ``faces`` are aligned correctly.
|
|
365
|
+
"""
|
|
366
|
+
cdef size_t i
|
|
367
|
+
for i in range(faces.n_faces):
|
|
368
|
+
if not face_check_alignment(faces.faces[i]):
|
|
369
|
+
return False
|
|
370
|
+
return True
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# sage_setup: distribution = sagemath-polyhedra
|
|
2
|
+
"""
|
|
3
|
+
Sorting of a list of faces.
|
|
4
|
+
"""
|
|
5
|
+
# ****************************************************************************
|
|
6
|
+
# Copyright (C) 2020 Jonathan Kliem <jonathan.kliem@gmail.com>
|
|
7
|
+
#
|
|
8
|
+
# This program is free software: you can redistribute it and/or modify
|
|
9
|
+
# it under the terms of the GNU General Public License as published by
|
|
10
|
+
# the Free Software Foundation, either version 2 of the License, or
|
|
11
|
+
# (at your option) any later version.
|
|
12
|
+
# https://www.gnu.org/licenses/
|
|
13
|
+
# ***************************************************************************
|
|
14
|
+
|
|
15
|
+
cdef void sort_faces_list(face_list_t faces) noexcept:
|
|
16
|
+
r"""
|
|
17
|
+
Sorts faces in place.
|
|
18
|
+
"""
|
|
19
|
+
cdef MemoryAllocator mem = MemoryAllocator()
|
|
20
|
+
|
|
21
|
+
# Merge sort needs a second list of pointers.
|
|
22
|
+
cdef face_t* extra_mem = <face_t*> mem.allocarray(faces.n_faces, sizeof(face_t))
|
|
23
|
+
|
|
24
|
+
# Sort the faces using merge sort.
|
|
25
|
+
_sort_faces_loop(faces.faces, faces.faces, extra_mem, faces.n_faces)
|
|
26
|
+
|
|
27
|
+
cdef void _sort_faces_loop(face_t* inp, face_t* out, face_t* extra_mem, size_t n_faces) noexcept:
|
|
28
|
+
"""
|
|
29
|
+
This is merge sort.
|
|
30
|
+
|
|
31
|
+
Sorts ``inp`` and returns it in ``out``.
|
|
32
|
+
|
|
33
|
+
.. WARNING::
|
|
34
|
+
|
|
35
|
+
``inp`` is the same as ``out`` or ``extra_mem``.
|
|
36
|
+
|
|
37
|
+
See :func:`sort_faces`.
|
|
38
|
+
"""
|
|
39
|
+
if n_faces == 0:
|
|
40
|
+
# Prevent it from crashing.
|
|
41
|
+
# In this case there is nothing to do anyway.
|
|
42
|
+
return
|
|
43
|
+
|
|
44
|
+
if n_faces == 1:
|
|
45
|
+
# The final case, where there is only one element.
|
|
46
|
+
out[0][0] = inp[0][0]
|
|
47
|
+
return
|
|
48
|
+
|
|
49
|
+
cdef size_t middle = n_faces//2
|
|
50
|
+
cdef size_t len_upper_half = n_faces - middle
|
|
51
|
+
|
|
52
|
+
# Sort the upper and lower half of ``inp`` iteratively into ``output2``.
|
|
53
|
+
_sort_faces_loop(inp, extra_mem, out, middle)
|
|
54
|
+
_sort_faces_loop(inp+middle, extra_mem+middle,
|
|
55
|
+
out+middle, len_upper_half)
|
|
56
|
+
|
|
57
|
+
# Merge lower and upper half into ``output1``.
|
|
58
|
+
cdef size_t i = 0 # index through lower half
|
|
59
|
+
cdef size_t j = middle # index through upper half
|
|
60
|
+
cdef size_t counter = 0 # counts how many elements have been "merged" already
|
|
61
|
+
cdef int val
|
|
62
|
+
while i < middle and j < n_faces:
|
|
63
|
+
# Compare the lowest elements of lower and upper half.
|
|
64
|
+
val = face_cmp(extra_mem[i], extra_mem[j])
|
|
65
|
+
if val < 0:
|
|
66
|
+
out[counter][0] = extra_mem[i][0]
|
|
67
|
+
i += 1
|
|
68
|
+
counter += 1
|
|
69
|
+
else:
|
|
70
|
+
out[counter][0] = extra_mem[j][0]
|
|
71
|
+
j += 1
|
|
72
|
+
counter += 1
|
|
73
|
+
if i < middle:
|
|
74
|
+
# Add the remaining elements of lower half.
|
|
75
|
+
while i < middle:
|
|
76
|
+
out[counter][0] = extra_mem[i][0]
|
|
77
|
+
i += 1
|
|
78
|
+
counter += 1
|
|
79
|
+
else:
|
|
80
|
+
# Add the remaining elements of upper half.
|
|
81
|
+
while j < n_faces:
|
|
82
|
+
out[counter][0] = extra_mem[j][0]
|
|
83
|
+
j += 1
|
|
84
|
+
counter += 1
|
sage/geometry/polyhedron/combinatorial_polyhedron/list_of_faces.cpython-314-x86_64-linux-musl.so
ADDED
|
Binary file
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# sage_setup: distribution = sagemath-polyhedra
|
|
2
|
+
cimport cython
|
|
3
|
+
from sage.geometry.polyhedron.combinatorial_polyhedron.face_list_data_structure cimport face_list_t, face_t
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
@cython.final
|
|
7
|
+
cdef class ListOfFaces:
|
|
8
|
+
# ``data`` points to the raw data.
|
|
9
|
+
# It will be of "type" ``uint64_t[n_faces][face_length]``
|
|
10
|
+
cdef face_list_t data
|
|
11
|
+
|
|
12
|
+
cpdef ListOfFaces __copy__(self)
|
|
13
|
+
|
|
14
|
+
cpdef int compute_dimension(self) except -2
|
|
15
|
+
|
|
16
|
+
cdef inline size_t n_faces(self) noexcept:
|
|
17
|
+
return self.data.n_faces
|
|
18
|
+
cdef inline size_t n_atoms(self) noexcept:
|
|
19
|
+
return self.data.n_atoms
|
|
20
|
+
cdef inline size_t n_coatoms(self) noexcept:
|
|
21
|
+
return self.data.n_coatoms
|
|
22
|
+
|
|
23
|
+
cpdef ListOfFaces pyramid(self)
|
|
24
|
+
|
|
25
|
+
cdef ListOfFaces delete_atoms_unsafe(self, bint* delete, face_t face) # not in place
|
|
26
|
+
cdef void delete_faces_unsafe(self, bint* delete, face_t face) noexcept # in place
|
|
27
|
+
|
|
28
|
+
cdef void get_not_inclusion_maximal_unsafe(self, bint *not_inclusion_maximal) noexcept
|
|
29
|
+
cdef void get_faces_all_set_unsafe(self, bint *all_set) noexcept
|
|
30
|
+
|
|
31
|
+
cdef tuple face_as_combinatorial_polyhedron(ListOfFaces facets, ListOfFaces Vrep, face_t face, bint dual)
|