passagemath-polyhedra 10.6.37__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.
- passagemath_polyhedra/__init__.py +3 -0
- passagemath_polyhedra-10.6.37.dist-info/METADATA +367 -0
- passagemath_polyhedra-10.6.37.dist-info/METADATA.bak +369 -0
- passagemath_polyhedra-10.6.37.dist-info/RECORD +209 -0
- passagemath_polyhedra-10.6.37.dist-info/WHEEL +5 -0
- passagemath_polyhedra-10.6.37.dist-info/top_level.txt +3 -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 +3905 -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
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
# sage_setup: distribution = sagemath-polyhedra
|
|
2
|
+
"""
|
|
3
|
+
Cython data structure for combinatorial 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
|
+
from memory_allocator cimport MemoryAllocator
|
|
16
|
+
from sage.data_structures.bitset_base cimport *
|
|
17
|
+
|
|
18
|
+
ctypedef int simple
|
|
19
|
+
ctypedef long standard
|
|
20
|
+
|
|
21
|
+
cdef struct face_s:
|
|
22
|
+
sparse_bitset_t atoms
|
|
23
|
+
bitset_t coatoms
|
|
24
|
+
|
|
25
|
+
ctypedef face_s face_t[1]
|
|
26
|
+
|
|
27
|
+
ctypedef fused algorithm_variant:
|
|
28
|
+
simple
|
|
29
|
+
standard
|
|
30
|
+
|
|
31
|
+
#############################################################################
|
|
32
|
+
# Face Initialization
|
|
33
|
+
#############################################################################
|
|
34
|
+
|
|
35
|
+
cdef inline bint face_init(face_t face, mp_bitcnt_t n_atoms, mp_bitcnt_t n_coatoms) except -1:
|
|
36
|
+
"""
|
|
37
|
+
Initialize and clear ``face``.
|
|
38
|
+
"""
|
|
39
|
+
if n_coatoms == 0:
|
|
40
|
+
# Special case for trivial polyhedra.
|
|
41
|
+
n_coatoms += 1
|
|
42
|
+
if n_atoms == 0:
|
|
43
|
+
n_atoms += 1
|
|
44
|
+
bitset_init(face.atoms, n_atoms)
|
|
45
|
+
bitset_init(face.coatoms, n_coatoms)
|
|
46
|
+
|
|
47
|
+
cdef inline void face_free(face_t face) noexcept:
|
|
48
|
+
"""
|
|
49
|
+
Free ``face``.
|
|
50
|
+
"""
|
|
51
|
+
bitset_free(face.atoms)
|
|
52
|
+
bitset_free(face.coatoms)
|
|
53
|
+
|
|
54
|
+
cdef inline bint face_check_alignment(face_t face) noexcept:
|
|
55
|
+
"""
|
|
56
|
+
Return whether the data is correctly aligned.
|
|
57
|
+
"""
|
|
58
|
+
return bitset_check_alignment(face.atoms)
|
|
59
|
+
|
|
60
|
+
cdef inline void face_clear(face_t face) noexcept:
|
|
61
|
+
"""
|
|
62
|
+
Remove all atoms and coatoms from face.
|
|
63
|
+
"""
|
|
64
|
+
bitset_clear(face.atoms)
|
|
65
|
+
bitset_clear(face.coatoms)
|
|
66
|
+
|
|
67
|
+
cdef inline void face_copy(face_t dst, face_t src) noexcept:
|
|
68
|
+
"""
|
|
69
|
+
Copy src to dst overwriting dst.
|
|
70
|
+
|
|
71
|
+
dst may contain more atoms and coatoms, but not less.
|
|
72
|
+
"""
|
|
73
|
+
bitset_copy_flex(dst.atoms, src.atoms)
|
|
74
|
+
bitset_copy_flex(dst.coatoms, src.coatoms)
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
#############################################################################
|
|
78
|
+
# Face Comparison
|
|
79
|
+
#############################################################################
|
|
80
|
+
|
|
81
|
+
cdef inline bint face_isempty(face_t face) noexcept nogil:
|
|
82
|
+
"""
|
|
83
|
+
Return whether ``face`` contains no coatoms.
|
|
84
|
+
"""
|
|
85
|
+
return bitset_isempty(face.atoms)
|
|
86
|
+
|
|
87
|
+
cdef inline int face_cmp(face_t a, face_t b) noexcept:
|
|
88
|
+
"""
|
|
89
|
+
Return ``0`` if the faces are equal and consistently
|
|
90
|
+
``-1`` and ``1`` if not.
|
|
91
|
+
"""
|
|
92
|
+
return bitset_cmp(a.atoms, b.atoms)
|
|
93
|
+
|
|
94
|
+
cdef inline bint face_issubset_fused(face_t a, face_t b, algorithm_variant algorithm) noexcept nogil:
|
|
95
|
+
"""
|
|
96
|
+
Return whether ``a`` is a subface of ``b``.
|
|
97
|
+
"""
|
|
98
|
+
if algorithm_variant is standard:
|
|
99
|
+
return bitset_issubset(a.atoms, b.atoms)
|
|
100
|
+
else:
|
|
101
|
+
return bitset_issuperset(a.coatoms, b.coatoms)
|
|
102
|
+
|
|
103
|
+
cdef inline bint face_issubset(face_t a, face_t b) noexcept nogil:
|
|
104
|
+
return face_issubset_fused(a, b, <standard> 0)
|
|
105
|
+
|
|
106
|
+
#############################################################################
|
|
107
|
+
# Face Bit Manipulation
|
|
108
|
+
#############################################################################
|
|
109
|
+
|
|
110
|
+
cdef inline bint face_atom_in(face_t face, mp_bitcnt_t n) noexcept:
|
|
111
|
+
"""
|
|
112
|
+
Return whether ``n`` is an atom of ``face``.
|
|
113
|
+
"""
|
|
114
|
+
return bitset_in(face.atoms, n)
|
|
115
|
+
|
|
116
|
+
cdef inline void face_add_atom(face_t face, mp_bitcnt_t n) noexcept:
|
|
117
|
+
"""
|
|
118
|
+
Add atom `n` to the face.
|
|
119
|
+
"""
|
|
120
|
+
bitset_add(face.atoms, n)
|
|
121
|
+
|
|
122
|
+
cdef inline int face_add_atom_safe(face_t face, mp_bitcnt_t n) except -1:
|
|
123
|
+
"""
|
|
124
|
+
Add atom `n` to the face.
|
|
125
|
+
"""
|
|
126
|
+
if (n > face.atoms.size):
|
|
127
|
+
raise KeyError(n)
|
|
128
|
+
bitset_add(face.atoms, n)
|
|
129
|
+
|
|
130
|
+
cdef inline void face_discard_atom(face_t face, mp_bitcnt_t n) noexcept:
|
|
131
|
+
"""
|
|
132
|
+
Discard atom `n` of the face.
|
|
133
|
+
"""
|
|
134
|
+
bitset_discard(face.atoms, n)
|
|
135
|
+
|
|
136
|
+
cdef inline void facet_set_coatom(face_t face, mp_bitcnt_t n) noexcept:
|
|
137
|
+
"""
|
|
138
|
+
Set the facet to be coatom ``n``.
|
|
139
|
+
"""
|
|
140
|
+
bitset_clear(face.coatoms)
|
|
141
|
+
bitset_add(face.coatoms, n)
|
|
142
|
+
|
|
143
|
+
cdef inline void face_set_first_n_atoms(face_t face, mp_bitcnt_t n) noexcept:
|
|
144
|
+
"""
|
|
145
|
+
Set exactly the first ``n`` atoms.
|
|
146
|
+
"""
|
|
147
|
+
bitset_set_first_n(face.atoms, n)
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
#############################################################################
|
|
151
|
+
# Face Searching
|
|
152
|
+
#############################################################################
|
|
153
|
+
|
|
154
|
+
cdef inline long face_next_atom(face_t face, mp_bitcnt_t n) noexcept:
|
|
155
|
+
"""
|
|
156
|
+
Return the index of the next atom in ``face`` with index >= ``n``.
|
|
157
|
+
|
|
158
|
+
In case there are none, return ``-1``.
|
|
159
|
+
"""
|
|
160
|
+
return bitset_next(face.atoms, n)
|
|
161
|
+
|
|
162
|
+
cdef inline long face_first_missing_atom(face_t face) noexcept:
|
|
163
|
+
"""
|
|
164
|
+
Return the index of the first atom not in ``face``.
|
|
165
|
+
|
|
166
|
+
In case there are none, return ``-1``.
|
|
167
|
+
"""
|
|
168
|
+
return bitset_first_in_complement(face.atoms)
|
|
169
|
+
|
|
170
|
+
cdef inline long face_len_atoms(face_t face) noexcept nogil:
|
|
171
|
+
"""
|
|
172
|
+
Calculate the number of atoms in the face.
|
|
173
|
+
"""
|
|
174
|
+
return bitset_len(face.atoms)
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
#############################################################################
|
|
178
|
+
# Arithmetic
|
|
179
|
+
#############################################################################
|
|
180
|
+
|
|
181
|
+
cdef inline void face_intersection_fused(face_t dest, face_t A, face_t B, algorithm_variant algorithm) noexcept nogil:
|
|
182
|
+
"""
|
|
183
|
+
Set ``dest`` to the intersection of ``A`` and ``B``.
|
|
184
|
+
"""
|
|
185
|
+
if algorithm_variant is standard:
|
|
186
|
+
# Also setting the nonzero positions.
|
|
187
|
+
sparse_bitset_intersection(dest.atoms, A.atoms, B.atoms)
|
|
188
|
+
else:
|
|
189
|
+
bitset_intersection(dest.atoms, A.atoms, B.atoms)
|
|
190
|
+
bitset_union(dest.coatoms, A.coatoms, B.coatoms)
|
|
191
|
+
|
|
192
|
+
cdef inline void face_intersection(face_t dest, face_t A, face_t B) noexcept nogil:
|
|
193
|
+
face_intersection_fused(dest, A, B, <standard> 0)
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
#############################################################################
|
|
197
|
+
# Miscellaneous
|
|
198
|
+
#############################################################################
|
|
199
|
+
|
|
200
|
+
cdef inline void swap_faces(face_t a, face_t b) noexcept nogil:
|
|
201
|
+
cdef face_t tmp
|
|
202
|
+
tmp[0] = a[0]
|
|
203
|
+
a[0] = b[0]
|
|
204
|
+
b[0] = tmp[0]
|
|
205
|
+
|
|
206
|
+
cdef inline bint faces_are_identical(face_t a, face_t b) noexcept nogil:
|
|
207
|
+
return a.atoms.limbs == b.atoms.limbs
|
sage/geometry/polyhedron/combinatorial_polyhedron/face_iterator.cpython-314-x86_64-linux-musl.so
ADDED
|
Binary file
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
# sage_setup: distribution = sagemath-polyhedra
|
|
2
|
+
cimport cython
|
|
3
|
+
from sage.structure.sage_object cimport SageObject
|
|
4
|
+
from sage.geometry.polyhedron.combinatorial_polyhedron.list_of_faces cimport ListOfFaces
|
|
5
|
+
from sage.geometry.polyhedron.combinatorial_polyhedron.face_data_structure cimport face_t
|
|
6
|
+
from sage.geometry.polyhedron.combinatorial_polyhedron.face_list_data_structure cimport face_list_t
|
|
7
|
+
from sage.geometry.polyhedron.combinatorial_polyhedron.combinatorial_face cimport CombinatorialFace
|
|
8
|
+
|
|
9
|
+
cdef enum FaceStatus:
|
|
10
|
+
NOT_INITIALIZED
|
|
11
|
+
INITIALIZED
|
|
12
|
+
IGNORE_SUBSETS
|
|
13
|
+
ONLY_VISIT_SUBSETS
|
|
14
|
+
|
|
15
|
+
cdef struct iter_s:
|
|
16
|
+
bint dual # if 1, then iterate over dual Polyhedron
|
|
17
|
+
face_t face # the current face of the iterator
|
|
18
|
+
FaceStatus face_status
|
|
19
|
+
size_t *atom_rep # a place where atom-representation of face will be stored
|
|
20
|
+
size_t *coatom_rep # a place where coatom-representation of face will be stored
|
|
21
|
+
int current_dimension # dimension of current face, dual dimension if ``dual``
|
|
22
|
+
int dimension # dimension of the polyhedron
|
|
23
|
+
int output_dimension # only faces of this (dual?) dimension are considered
|
|
24
|
+
int lowest_dimension # don't consider faces below this (dual?) dimension
|
|
25
|
+
int highest_dimension # don't consider faces above this (dual?) dimension
|
|
26
|
+
size_t _index # this counts the number of seen faces, useful for hasing the faces
|
|
27
|
+
|
|
28
|
+
# ``visited_all`` points to faces, of which we have visited all faces already.
|
|
29
|
+
# The number of faces in ``visited_all`` might depend on the current dimension:
|
|
30
|
+
# Consider we visit the facets A,B of some face F.
|
|
31
|
+
# We will first visit all faces of A and then add A to visited_all.
|
|
32
|
+
# Then we visit all faces of B and add B to visited_all.
|
|
33
|
+
# Then we have visited F completely.
|
|
34
|
+
# Instead of having A and B in ``visited_all`` we will point to F.
|
|
35
|
+
# In this way, we will append ``visited_all`` in lower dimension, but
|
|
36
|
+
# will ignore those changes when going up in dimension again.
|
|
37
|
+
# This is why the number of faces in ``visited_all``depends on dimension.
|
|
38
|
+
face_list_t* visited_all
|
|
39
|
+
|
|
40
|
+
# ``new_faces`` is where the new faces are stored.
|
|
41
|
+
# Needs to be long enough to store all possible intersections of a face with all coatoms.
|
|
42
|
+
face_list_t* new_faces
|
|
43
|
+
|
|
44
|
+
# After having visited a face completely, we want to add it to ``visited_all``.
|
|
45
|
+
# ``first_time[i]`` will indicate, whether there is one more face in
|
|
46
|
+
# ``newfaces[i]`` then ``n_newfaces[i]`` suggests
|
|
47
|
+
# that has to be added to ``visited_all``.
|
|
48
|
+
# If ``first_time[i] == False``, we still need to
|
|
49
|
+
# add ``newfaces[i][n_newfaces[i]]`` to ``visited_all``.
|
|
50
|
+
bint *first_time
|
|
51
|
+
|
|
52
|
+
# The number of elements in newfaces[current_dimension],
|
|
53
|
+
# that have not been visited yet.
|
|
54
|
+
size_t yet_to_visit
|
|
55
|
+
size_t n_coatoms
|
|
56
|
+
|
|
57
|
+
ctypedef iter_s iter_t[1]
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
cdef class FaceIterator_base(SageObject):
|
|
61
|
+
cdef iter_t structure
|
|
62
|
+
cdef readonly bint dual # if 1, then iterate over dual Polyhedron
|
|
63
|
+
|
|
64
|
+
# some copies from ``CombinatorialPolyhedron``
|
|
65
|
+
cdef tuple _Vrep, _facet_names, _equations
|
|
66
|
+
cdef size_t _n_equations, _n_facets
|
|
67
|
+
cdef bint _bounded
|
|
68
|
+
cdef face_t _far_face
|
|
69
|
+
|
|
70
|
+
# Atoms and coatoms are the vertices/facets of the Polyedron.
|
|
71
|
+
# If ``dual == 0``, then coatoms are facets, atoms vertices and vice versa.
|
|
72
|
+
cdef ListOfFaces atoms, coatoms, coatoms_coatom_rep
|
|
73
|
+
|
|
74
|
+
cdef inline CombinatorialFace next_face(self)
|
|
75
|
+
cdef inline int next_dimension(self) except -1
|
|
76
|
+
cdef inline int next_face_loop(self) except -1
|
|
77
|
+
cdef size_t n_atom_rep(self) except -1
|
|
78
|
+
cdef size_t set_coatom_rep(self) except -1
|
|
79
|
+
cdef size_t set_atom_rep(self) except -1
|
|
80
|
+
cdef int ignore_subsets(self) except -1
|
|
81
|
+
cdef int only_subsets(self) except -1
|
|
82
|
+
cdef int find_face(self, face_t face) except -1
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
@cython.final
|
|
86
|
+
cdef class FaceIterator(FaceIterator_base):
|
|
87
|
+
pass
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
@cython.final
|
|
91
|
+
cdef class FaceIterator_geom(FaceIterator_base):
|
|
92
|
+
cdef int _trivial_faces # Whether to yield the trivial faces.
|
|
93
|
+
cdef object _requested_dim # Dimension requested on init.
|
|
94
|
+
cdef readonly object P # The original polyhedron.
|
|
95
|
+
|
|
96
|
+
cdef int parallel_f_vector(iter_t* structures, size_t num_threads, size_t parallelization_depth, size_t *f_vector) except -1
|
|
97
|
+
|
|
98
|
+
# Nogil definitions of crucial functions.
|
|
99
|
+
|
|
100
|
+
cdef int next_dimension(iter_t structure, size_t parallelization_depth=?) except -1 nogil
|
|
101
|
+
cdef int next_face_loop(iter_t structure) except -1 nogil
|
|
102
|
+
cdef size_t n_atom_rep(iter_t structure) except -1 nogil
|