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
|
@@ -0,0 +1,587 @@
|
|
|
1
|
+
# sage_setup: distribution = sagemath-polyhedra
|
|
2
|
+
r"""
|
|
3
|
+
List of faces
|
|
4
|
+
|
|
5
|
+
This module provides a class to store faces of a polyhedron in Bit-representation.
|
|
6
|
+
|
|
7
|
+
This class allocates memory to store the faces in.
|
|
8
|
+
A face will be stored as vertex-incidences, where each Bit represents an incidence.
|
|
9
|
+
In :mod:`~sage.geometry.polyhedron.combinatorial_polyhedron.conversions` there a methods to actually convert facets of a polyhedron
|
|
10
|
+
to bit-representations of vertices stored in :class:`ListOfFaces`.
|
|
11
|
+
|
|
12
|
+
Moreover, :class:`ListOfFaces` calculates the dimension of a polyhedron, assuming the
|
|
13
|
+
faces are the facets of this polyhedron.
|
|
14
|
+
|
|
15
|
+
Each face is stored over-aligned according to the ``chunktype``.
|
|
16
|
+
|
|
17
|
+
.. SEEALSO::
|
|
18
|
+
|
|
19
|
+
:mod:`sage.geometry.polyhedron.combinatorial_polyhedron.base`.
|
|
20
|
+
|
|
21
|
+
EXAMPLES:
|
|
22
|
+
|
|
23
|
+
Provide enough space to store `20` faces as incidences to `60` vertices::
|
|
24
|
+
|
|
25
|
+
sage: from sage.geometry.polyhedron.combinatorial_polyhedron.list_of_faces \
|
|
26
|
+
....: import ListOfFaces
|
|
27
|
+
sage: face_list = ListOfFaces(20, 60, 20)
|
|
28
|
+
sage: face_list.matrix().is_zero()
|
|
29
|
+
True
|
|
30
|
+
|
|
31
|
+
Obtain the facets of a polyhedron::
|
|
32
|
+
|
|
33
|
+
sage: from sage.geometry.polyhedron.combinatorial_polyhedron.conversions \
|
|
34
|
+
....: import incidence_matrix_to_bit_rep_of_facets
|
|
35
|
+
sage: P = polytopes.cube()
|
|
36
|
+
sage: face_list = incidence_matrix_to_bit_rep_of_facets(P.incidence_matrix())
|
|
37
|
+
sage: face_list = incidence_matrix_to_bit_rep_of_facets(P.incidence_matrix())
|
|
38
|
+
sage: face_list.compute_dimension()
|
|
39
|
+
3
|
|
40
|
+
|
|
41
|
+
Obtain the Vrepresentation of a polyhedron as facet-incidences::
|
|
42
|
+
|
|
43
|
+
sage: # needs sage.combinat
|
|
44
|
+
sage: from sage.geometry.polyhedron.combinatorial_polyhedron.conversions \
|
|
45
|
+
....: import incidence_matrix_to_bit_rep_of_Vrep
|
|
46
|
+
sage: P = polytopes.associahedron(['A',3])
|
|
47
|
+
sage: face_list = incidence_matrix_to_bit_rep_of_Vrep(P.incidence_matrix())
|
|
48
|
+
sage: face_list.compute_dimension()
|
|
49
|
+
3
|
|
50
|
+
|
|
51
|
+
Obtain the facets of a polyhedron as :class:`ListOfFaces` from a facet list::
|
|
52
|
+
|
|
53
|
+
sage: from sage.geometry.polyhedron.combinatorial_polyhedron.conversions \
|
|
54
|
+
....: import facets_tuple_to_bit_rep_of_facets
|
|
55
|
+
sage: facets = ((0,1,2), (0,1,3), (0,2,3), (1,2,3))
|
|
56
|
+
sage: face_list = facets_tuple_to_bit_rep_of_facets(facets, 4)
|
|
57
|
+
|
|
58
|
+
Likewise for the Vrepresentatives as facet-incidences::
|
|
59
|
+
|
|
60
|
+
sage: from sage.geometry.polyhedron.combinatorial_polyhedron.conversions \
|
|
61
|
+
....: import facets_tuple_to_bit_rep_of_Vrep
|
|
62
|
+
sage: facets = ((0,1,2), (0,1,3), (0,2,3), (1,2,3))
|
|
63
|
+
sage: face_list = facets_tuple_to_bit_rep_of_Vrep(facets, 4)
|
|
64
|
+
|
|
65
|
+
Obtain the matrix of a list of faces::
|
|
66
|
+
|
|
67
|
+
sage: face_list.matrix()
|
|
68
|
+
[1 1 1 0]
|
|
69
|
+
[1 1 0 1]
|
|
70
|
+
[1 0 1 1]
|
|
71
|
+
[0 1 1 1]
|
|
72
|
+
|
|
73
|
+
.. SEEALSO::
|
|
74
|
+
|
|
75
|
+
:mod:`~sage.geometry.polyhedron.combinatorial_polyhedron.base`,
|
|
76
|
+
:mod:`~sage.geometry.polyhedron.combinatorial_polyhedron.face_iterator`,
|
|
77
|
+
:mod:`~sage.geometry.polyhedron.combinatorial_polyhedron.conversions`,
|
|
78
|
+
:mod:`~sage.geometry.polyhedron.combinatorial_polyhedron.polyhedron_faces_lattice`.
|
|
79
|
+
|
|
80
|
+
AUTHOR:
|
|
81
|
+
|
|
82
|
+
- Jonathan Kliem (2019-04)
|
|
83
|
+
"""
|
|
84
|
+
# ****************************************************************************
|
|
85
|
+
# Copyright (C) 2019 Jonathan Kliem <jonathan.kliem@gmail.com>
|
|
86
|
+
#
|
|
87
|
+
# This program is free software: you can redistribute it and/or modify
|
|
88
|
+
# it under the terms of the GNU General Public License as published by
|
|
89
|
+
# the Free Software Foundation, either version 2 of the License, or
|
|
90
|
+
# (at your option) any later version.
|
|
91
|
+
# https://www.gnu.org/licenses/
|
|
92
|
+
# ****************************************************************************
|
|
93
|
+
|
|
94
|
+
from sage.matrix.matrix_dense cimport Matrix_dense
|
|
95
|
+
|
|
96
|
+
from sage.geometry.polyhedron.combinatorial_polyhedron.face_list_data_structure cimport *
|
|
97
|
+
|
|
98
|
+
cdef extern from "Python.h":
|
|
99
|
+
int unlikely(int) nogil # Defined by Cython
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
cdef class ListOfFaces:
|
|
103
|
+
r"""
|
|
104
|
+
A class to store the Bit-representation of faces in.
|
|
105
|
+
|
|
106
|
+
This class will allocate the memory for the faces.
|
|
107
|
+
|
|
108
|
+
INPUT:
|
|
109
|
+
|
|
110
|
+
- ``n_faces`` -- the number of faces to be stored
|
|
111
|
+
- ``n_atoms`` -- the total number of atoms the faces contain
|
|
112
|
+
- ``n_coatoms`` -- the total number of coatoms of the polyhedron
|
|
113
|
+
|
|
114
|
+
.. SEEALSO::
|
|
115
|
+
|
|
116
|
+
:meth:`incidence_matrix_to_bit_rep_of_facets`,
|
|
117
|
+
:meth:`incidence_matrix_to_bit_rep_of_Vrep`,
|
|
118
|
+
:meth:`facets_tuple_to_bit_rep_of_facets`,
|
|
119
|
+
:meth:`facets_tuple_to_bit_rep_of_Vrep`,
|
|
120
|
+
:class:`~sage.geometry.polyhedron.combinatorial_polyhedron.face_iterator.FaceIterator`,
|
|
121
|
+
:class:`~sage.geometry.polyhedron.combinatorial_polyhedron.base.CombinatorialPolyhedron`.
|
|
122
|
+
|
|
123
|
+
EXAMPLES::
|
|
124
|
+
|
|
125
|
+
sage: from sage.geometry.polyhedron.combinatorial_polyhedron.list_of_faces \
|
|
126
|
+
....: import ListOfFaces
|
|
127
|
+
sage: facets = ListOfFaces(5, 13, 5)
|
|
128
|
+
sage: facets.matrix().dimensions()
|
|
129
|
+
(5, 13)
|
|
130
|
+
"""
|
|
131
|
+
def __cinit__(self, size_t n_faces, size_t n_atoms, size_t n_coatoms):
|
|
132
|
+
r"""
|
|
133
|
+
Initialize :class:`ListOfFaces`.
|
|
134
|
+
|
|
135
|
+
See :class:`ListOfFaces`.
|
|
136
|
+
|
|
137
|
+
TESTS::
|
|
138
|
+
|
|
139
|
+
sage: TestSuite(sage.geometry.polyhedron.combinatorial_polyhedron.list_of_faces.ListOfFaces).run()
|
|
140
|
+
"""
|
|
141
|
+
# Note that all values are set to zero at the time ``__cinit__`` is called:
|
|
142
|
+
# https://cython.readthedocs.io/en/latest/src/userguide/special_methods.html#initialisation-methods
|
|
143
|
+
# In particular, ``__dealloc__`` will not do harm in this case.
|
|
144
|
+
|
|
145
|
+
face_list_init(self.data, n_faces, n_atoms, n_coatoms)
|
|
146
|
+
|
|
147
|
+
def __dealloc__(self):
|
|
148
|
+
r"""
|
|
149
|
+
TESTS:
|
|
150
|
+
|
|
151
|
+
Check that failed ``cinit`` does not give segmentation fault or similar::
|
|
152
|
+
|
|
153
|
+
sage: from sage.geometry.polyhedron.combinatorial_polyhedron.list_of_faces import ListOfFaces
|
|
154
|
+
sage: ListOfFaces(-1, -1, -1) # indirect doctest
|
|
155
|
+
Traceback (most recent call last):
|
|
156
|
+
...
|
|
157
|
+
OverflowError: can't convert negative value to size_t
|
|
158
|
+
|
|
159
|
+
sage: from memory_allocator.test import TestMemoryAllocator
|
|
160
|
+
sage: t = TestMemoryAllocator()
|
|
161
|
+
sage: m = t.size_t_max()
|
|
162
|
+
sage: ListOfFaces(10, m, 10)
|
|
163
|
+
Traceback (most recent call last):
|
|
164
|
+
...
|
|
165
|
+
MemoryError: failed to allocate ...
|
|
166
|
+
"""
|
|
167
|
+
face_list_free(self.data)
|
|
168
|
+
|
|
169
|
+
def _test_alignment(self):
|
|
170
|
+
r"""
|
|
171
|
+
Check the correct alignment.
|
|
172
|
+
|
|
173
|
+
TESTS::
|
|
174
|
+
|
|
175
|
+
sage: from sage.geometry.polyhedron.combinatorial_polyhedron.list_of_faces \
|
|
176
|
+
....: import ListOfFaces
|
|
177
|
+
sage: facets = ListOfFaces(10, 13, 10)
|
|
178
|
+
sage: facets._test_alignment()
|
|
179
|
+
"""
|
|
180
|
+
assert face_list_check_alignment(self.data)
|
|
181
|
+
|
|
182
|
+
cpdef ListOfFaces __copy__(self):
|
|
183
|
+
r"""
|
|
184
|
+
Return a copy of ``self``.
|
|
185
|
+
|
|
186
|
+
EXAMPLES::
|
|
187
|
+
|
|
188
|
+
sage: from sage.geometry.polyhedron.combinatorial_polyhedron.list_of_faces \
|
|
189
|
+
....: import ListOfFaces
|
|
190
|
+
sage: facets = ListOfFaces(5, 13, 5)
|
|
191
|
+
sage: copy(facets).matrix().dimensions()
|
|
192
|
+
(5, 13)
|
|
193
|
+
|
|
194
|
+
TESTS::
|
|
195
|
+
|
|
196
|
+
sage: from sage.geometry.polyhedron.combinatorial_polyhedron.conversions \
|
|
197
|
+
....: import facets_tuple_to_bit_rep_of_facets
|
|
198
|
+
sage: bi_pyr = ((0,1,4), (1,2,4), (2,3,4), (3,0,4),
|
|
199
|
+
....: (0,1,5), (1,2,5), (2,3,5), (3,0,5))
|
|
200
|
+
sage: facets = facets_tuple_to_bit_rep_of_facets(bi_pyr, 6)
|
|
201
|
+
sage: facets.compute_dimension()
|
|
202
|
+
3
|
|
203
|
+
sage: copy(facets).compute_dimension()
|
|
204
|
+
3
|
|
205
|
+
sage: facets.matrix() == copy(facets).matrix()
|
|
206
|
+
True
|
|
207
|
+
sage: copy(facets) is facets
|
|
208
|
+
False
|
|
209
|
+
"""
|
|
210
|
+
cdef ListOfFaces copy = ListOfFaces(self.n_faces(), self.n_atoms(), self.n_coatoms())
|
|
211
|
+
face_list_copy(copy.data, self.data)
|
|
212
|
+
return copy
|
|
213
|
+
|
|
214
|
+
cpdef int compute_dimension(self) except -2:
|
|
215
|
+
r"""
|
|
216
|
+
Compute the dimension of a polyhedron by its facets.
|
|
217
|
+
|
|
218
|
+
This assumes that ``self`` is the list of facets of a polyhedron.
|
|
219
|
+
|
|
220
|
+
EXAMPLES::
|
|
221
|
+
|
|
222
|
+
sage: from sage.geometry.polyhedron.combinatorial_polyhedron.conversions \
|
|
223
|
+
....: import facets_tuple_to_bit_rep_of_facets, \
|
|
224
|
+
....: facets_tuple_to_bit_rep_of_Vrep
|
|
225
|
+
sage: bi_pyr = ((0,1,4), (1,2,4), (2,3,4), (3,0,4),
|
|
226
|
+
....: (0,1,5), (1,2,5), (2,3,5), (3,0,5))
|
|
227
|
+
sage: facets = facets_tuple_to_bit_rep_of_facets(bi_pyr, 6)
|
|
228
|
+
sage: Vrep = facets_tuple_to_bit_rep_of_Vrep(bi_pyr, 6)
|
|
229
|
+
sage: facets.compute_dimension()
|
|
230
|
+
3
|
|
231
|
+
sage: Vrep.compute_dimension()
|
|
232
|
+
3
|
|
233
|
+
|
|
234
|
+
ALGORITHM:
|
|
235
|
+
|
|
236
|
+
This is done by iteration:
|
|
237
|
+
|
|
238
|
+
Computes the facets of one of the facets (i.e. the ridges contained in
|
|
239
|
+
one of the facets). Then computes the dimension of the facet, by
|
|
240
|
+
considering its facets.
|
|
241
|
+
|
|
242
|
+
Repeats until a face has only one facet. Usually this is a vertex.
|
|
243
|
+
|
|
244
|
+
However, in the unbounded case, this might be different. The face with only
|
|
245
|
+
one facet might be a ray or a line. So the correct dimension of a
|
|
246
|
+
polyhedron with one facet is the number of ``[lines, rays, vertices]``
|
|
247
|
+
that the facet contains.
|
|
248
|
+
|
|
249
|
+
Hence, we know the dimension of a face, which has only one facet and
|
|
250
|
+
iteratively we know the dimension of entire polyhedron we started from.
|
|
251
|
+
|
|
252
|
+
TESTS::
|
|
253
|
+
|
|
254
|
+
sage: from sage.geometry.polyhedron.combinatorial_polyhedron.list_of_faces \
|
|
255
|
+
....: import ListOfFaces
|
|
256
|
+
sage: from sage.geometry.polyhedron.combinatorial_polyhedron.conversions \
|
|
257
|
+
....: import incidence_matrix_to_bit_rep_of_facets, \
|
|
258
|
+
....: incidence_matrix_to_bit_rep_of_Vrep
|
|
259
|
+
sage: bi_pyr = ((0,1,4), (1,2,4), (2,3,4), (3,0,4),
|
|
260
|
+
....: (0,1,5), (1,2,5), (2,3,5), (3,0,5))
|
|
261
|
+
sage: for _ in range(10):
|
|
262
|
+
....: points = tuple(tuple(randint(-1000,1000) for _ in range(10))
|
|
263
|
+
....: for _ in range(randint(3,15)))
|
|
264
|
+
....: P = Polyhedron(vertices=points)
|
|
265
|
+
....: inc = P.incidence_matrix()
|
|
266
|
+
....: mod_inc = inc.delete_columns([i for i,V in enumerate(P.Hrepresentation()) if V.is_equation()])
|
|
267
|
+
....: facets = incidence_matrix_to_bit_rep_of_facets(mod_inc)
|
|
268
|
+
....: vertices = incidence_matrix_to_bit_rep_of_Vrep(mod_inc)
|
|
269
|
+
....: d1 = P.dimension()
|
|
270
|
+
....: if d1 == 0:
|
|
271
|
+
....: continue
|
|
272
|
+
....: d2 = facets.compute_dimension()
|
|
273
|
+
....: d3 = vertices.compute_dimension()
|
|
274
|
+
....: if not d1 == d2 == d3:
|
|
275
|
+
....: print('calculation_dimension() seems to be incorrect')
|
|
276
|
+
"""
|
|
277
|
+
if self.n_faces() == 0:
|
|
278
|
+
raise TypeError("at least one face needed")
|
|
279
|
+
|
|
280
|
+
cdef size_t n_faces = self.n_faces()
|
|
281
|
+
|
|
282
|
+
cdef face_list_t empty_forbidden
|
|
283
|
+
empty_forbidden.n_faces = 0
|
|
284
|
+
|
|
285
|
+
if n_faces == 1:
|
|
286
|
+
# We expect the face to be the empty polyhedron.
|
|
287
|
+
# Possibly it contains more than one vertex/rays/lines.
|
|
288
|
+
# The dimension of a polyhedron with this face as only facet is
|
|
289
|
+
# the number of atoms it contains.
|
|
290
|
+
return face_len_atoms(self.data.faces[0])
|
|
291
|
+
|
|
292
|
+
# ``newfaces`` are all intersection of ``faces[n_faces -1]`` with previous faces.
|
|
293
|
+
# It needs to be allocated to store those faces.
|
|
294
|
+
cdef ListOfFaces new_faces = ListOfFaces(self.n_faces(), self.n_atoms(), self.n_coatoms())
|
|
295
|
+
|
|
296
|
+
# Calculating ``newfaces``
|
|
297
|
+
# such that ``newfaces`` points to all facets of ``faces[n_faces -1]``.
|
|
298
|
+
get_next_level(self.data, new_faces.data, empty_forbidden)
|
|
299
|
+
|
|
300
|
+
# Undo what ``get_next_level`` does.
|
|
301
|
+
self.data.n_faces += 1
|
|
302
|
+
|
|
303
|
+
# compute the dimension of the polyhedron,
|
|
304
|
+
# by calculating dimension of one of its faces.
|
|
305
|
+
return new_faces.compute_dimension() + 1
|
|
306
|
+
|
|
307
|
+
cpdef ListOfFaces pyramid(self):
|
|
308
|
+
r"""
|
|
309
|
+
Return the list of faces of the pyramid.
|
|
310
|
+
|
|
311
|
+
EXAMPLES::
|
|
312
|
+
|
|
313
|
+
sage: from sage.geometry.polyhedron.combinatorial_polyhedron.conversions \
|
|
314
|
+
....: import facets_tuple_to_bit_rep_of_facets
|
|
315
|
+
sage: facets = ((0,1,2), (0,1,3), (0,2,3), (1,2,3))
|
|
316
|
+
sage: face_list = facets_tuple_to_bit_rep_of_facets(facets, 4)
|
|
317
|
+
sage: face_list.matrix()
|
|
318
|
+
[1 1 1 0]
|
|
319
|
+
[1 1 0 1]
|
|
320
|
+
[1 0 1 1]
|
|
321
|
+
[0 1 1 1]
|
|
322
|
+
sage: face_list.pyramid().matrix()
|
|
323
|
+
[1 1 1 0 1]
|
|
324
|
+
[1 1 0 1 1]
|
|
325
|
+
[1 0 1 1 1]
|
|
326
|
+
[0 1 1 1 1]
|
|
327
|
+
[1 1 1 1 0]
|
|
328
|
+
|
|
329
|
+
Incorrect facets that illustrate how this method works::
|
|
330
|
+
|
|
331
|
+
sage: facets = ((0,1,2,3), (0,1,2,3), (0,1,2,3), (0,1,2,3))
|
|
332
|
+
sage: face_list = facets_tuple_to_bit_rep_of_facets(facets, 4)
|
|
333
|
+
sage: face_list.matrix()
|
|
334
|
+
[1 1 1 1]
|
|
335
|
+
[1 1 1 1]
|
|
336
|
+
[1 1 1 1]
|
|
337
|
+
[1 1 1 1]
|
|
338
|
+
sage: face_list.pyramid().matrix()
|
|
339
|
+
[1 1 1 1 1]
|
|
340
|
+
[1 1 1 1 1]
|
|
341
|
+
[1 1 1 1 1]
|
|
342
|
+
[1 1 1 1 1]
|
|
343
|
+
[1 1 1 1 0]
|
|
344
|
+
|
|
345
|
+
::
|
|
346
|
+
|
|
347
|
+
sage: facets = ((), (), (), ())
|
|
348
|
+
sage: face_list = facets_tuple_to_bit_rep_of_facets(facets, 4)
|
|
349
|
+
sage: face_list.matrix()
|
|
350
|
+
[0 0 0 0]
|
|
351
|
+
[0 0 0 0]
|
|
352
|
+
[0 0 0 0]
|
|
353
|
+
[0 0 0 0]
|
|
354
|
+
sage: face_list.pyramid().matrix()
|
|
355
|
+
[0 0 0 0 1]
|
|
356
|
+
[0 0 0 0 1]
|
|
357
|
+
[0 0 0 0 1]
|
|
358
|
+
[0 0 0 0 1]
|
|
359
|
+
[1 1 1 1 0]
|
|
360
|
+
"""
|
|
361
|
+
cdef ListOfFaces copy
|
|
362
|
+
cdef size_t i
|
|
363
|
+
cdef size_t n_faces = self.n_faces()
|
|
364
|
+
cdef size_t n_atoms = self.n_atoms()
|
|
365
|
+
|
|
366
|
+
# ``copy`` has a new atom and a new coatom.
|
|
367
|
+
copy = ListOfFaces(n_faces + 1, n_atoms + 1, n_faces + 1)
|
|
368
|
+
|
|
369
|
+
# Note that a pyramid is simple if and only if the base is simple.
|
|
370
|
+
|
|
371
|
+
face_list_copy(copy.data, self.data)
|
|
372
|
+
|
|
373
|
+
for i in range(n_faces):
|
|
374
|
+
face_add_atom(copy.data.faces[i], n_atoms)
|
|
375
|
+
facet_set_coatom(copy.data.faces[i], i)
|
|
376
|
+
|
|
377
|
+
copy.data.n_faces += 1
|
|
378
|
+
|
|
379
|
+
# The new coatom contains all atoms, but the new atom.
|
|
380
|
+
face_set_first_n_atoms(copy.data.faces[n_faces], n_atoms)
|
|
381
|
+
facet_set_coatom(copy.data.faces[n_faces], n_faces)
|
|
382
|
+
|
|
383
|
+
return copy
|
|
384
|
+
|
|
385
|
+
cdef ListOfFaces delete_atoms_unsafe(self, bint *delete, face_t face):
|
|
386
|
+
r"""
|
|
387
|
+
Return a copy of ``self`` where bits in ``delete`` have been
|
|
388
|
+
removed/contracted.
|
|
389
|
+
|
|
390
|
+
The the remaining bits will be shifted to the left.
|
|
391
|
+
|
|
392
|
+
If ``delete`` is ``NULL``, keep exactly the bits set in ``face``.
|
|
393
|
+
|
|
394
|
+
.. WARNING::
|
|
395
|
+
|
|
396
|
+
``delete`` is assumed to be of length ``self.n_atoms`` or NULL.
|
|
397
|
+
``face`` is assumed to be of length ``self.face_length`` if ``delete`` is not ``NULL``.
|
|
398
|
+
"""
|
|
399
|
+
|
|
400
|
+
cdef output_n_atoms
|
|
401
|
+
cdef size_t i, j
|
|
402
|
+
if delete is NULL:
|
|
403
|
+
output_n_atoms = face_len_atoms(face)
|
|
404
|
+
else:
|
|
405
|
+
output_n_atoms = self.n_atoms()
|
|
406
|
+
for i in range(self.n_atoms()):
|
|
407
|
+
if delete[i]:
|
|
408
|
+
output_n_atoms -= 1
|
|
409
|
+
|
|
410
|
+
cdef ListOfFaces output = ListOfFaces(self.n_faces(), output_n_atoms, self.n_coatoms())
|
|
411
|
+
cdef size_t counter = 0
|
|
412
|
+
cdef size_t n_atoms = self.n_atoms()
|
|
413
|
+
cdef size_t n_faces = self.n_faces()
|
|
414
|
+
for i in range(n_atoms):
|
|
415
|
+
if ((delete is NULL and face_atom_in(face, i)) or
|
|
416
|
+
(delete is not NULL and not delete[i])):
|
|
417
|
+
# The atom will be kept.
|
|
418
|
+
for j in range(n_faces):
|
|
419
|
+
if face_atom_in(self.data.faces[j], i):
|
|
420
|
+
face_add_atom(output.data.faces[j], counter)
|
|
421
|
+
counter += 1
|
|
422
|
+
|
|
423
|
+
return output
|
|
424
|
+
|
|
425
|
+
cdef void delete_faces_unsafe(self, bint *delete, face_t face) noexcept:
|
|
426
|
+
r"""
|
|
427
|
+
Delete face ``i`` if and only if ``delete[i]``.
|
|
428
|
+
|
|
429
|
+
Alternatively, deletes all faces such that the ``i``-th bit in ``face`` is not set.
|
|
430
|
+
|
|
431
|
+
This will modify ``self``.
|
|
432
|
+
|
|
433
|
+
.. WARNING::
|
|
434
|
+
|
|
435
|
+
``delete`` is assumed to be of length ``self.n_faces()`` or NULL.
|
|
436
|
+
``face`` is assumed to contain ``self.n_faces()`` atoms if ``delete`` is not ``NULL``.
|
|
437
|
+
"""
|
|
438
|
+
if delete is not NULL:
|
|
439
|
+
face_list_delete_faces_by_array(self.data, delete)
|
|
440
|
+
else:
|
|
441
|
+
face_list_delete_faces_by_face(self.data, face)
|
|
442
|
+
|
|
443
|
+
cdef void get_not_inclusion_maximal_unsafe(self, bint *not_inclusion_maximal) noexcept:
|
|
444
|
+
r"""
|
|
445
|
+
Get all faces that are not inclusion maximal.
|
|
446
|
+
|
|
447
|
+
Set ``not_inclusion_maximal[i]`` to one if ``self.data[i]`` is not
|
|
448
|
+
an inclusion-maximal face, otherwise to zero.
|
|
449
|
+
|
|
450
|
+
If there are duplicates, all but the last duplicate will be marked as
|
|
451
|
+
not inclusion maximal.
|
|
452
|
+
|
|
453
|
+
.. WARNING::
|
|
454
|
+
|
|
455
|
+
``not_inclusion_maximal`` is assumed to be at least of length ``self.n_atoms`` or NULL.
|
|
456
|
+
"""
|
|
457
|
+
cdef size_t i
|
|
458
|
+
memset(not_inclusion_maximal, 0, sizeof(bint)*self.n_faces())
|
|
459
|
+
for i in range(self.n_faces()):
|
|
460
|
+
not_inclusion_maximal[i] = is_not_maximal_fused(self.data, i, <standard> 0, not_inclusion_maximal)
|
|
461
|
+
|
|
462
|
+
cdef void get_faces_all_set_unsafe(self, bint *all_set) noexcept:
|
|
463
|
+
r"""
|
|
464
|
+
Get the faces that have all ``bits`` set.
|
|
465
|
+
|
|
466
|
+
Set ``all_set[i]`` to one if ``self.data[i]``
|
|
467
|
+
has all bits set, otherwise to zero.
|
|
468
|
+
|
|
469
|
+
.. WARNING::
|
|
470
|
+
|
|
471
|
+
``all_set`` is assumed to be at least of length ``self.n_atoms`` or NULL.
|
|
472
|
+
"""
|
|
473
|
+
cdef size_t i
|
|
474
|
+
for i in range(self.n_faces()):
|
|
475
|
+
if face_first_missing_atom(self.data.faces[i]) == -1:
|
|
476
|
+
all_set[i] = 1
|
|
477
|
+
else:
|
|
478
|
+
all_set[i] = 0
|
|
479
|
+
|
|
480
|
+
def matrix(self):
|
|
481
|
+
r"""
|
|
482
|
+
Obtain the matrix of ``self``.
|
|
483
|
+
|
|
484
|
+
Each row represents a face and each column an atom.
|
|
485
|
+
|
|
486
|
+
EXAMPLES::
|
|
487
|
+
|
|
488
|
+
sage: from sage.geometry.polyhedron.combinatorial_polyhedron.conversions \
|
|
489
|
+
....: import facets_tuple_to_bit_rep_of_facets, \
|
|
490
|
+
....: facets_tuple_to_bit_rep_of_Vrep
|
|
491
|
+
sage: bi_pyr = ((0,1,4), (1,2,4), (2,3,4), (3,0,4), (0,1,5), (1,2,5), (2,3,5), (3,0,5))
|
|
492
|
+
sage: facets = facets_tuple_to_bit_rep_of_facets(bi_pyr, 6)
|
|
493
|
+
sage: Vrep = facets_tuple_to_bit_rep_of_Vrep(bi_pyr, 6)
|
|
494
|
+
sage: facets.matrix()
|
|
495
|
+
[1 1 0 0 1 0]
|
|
496
|
+
[0 1 1 0 1 0]
|
|
497
|
+
[0 0 1 1 1 0]
|
|
498
|
+
[1 0 0 1 1 0]
|
|
499
|
+
[1 1 0 0 0 1]
|
|
500
|
+
[0 1 1 0 0 1]
|
|
501
|
+
[0 0 1 1 0 1]
|
|
502
|
+
[1 0 0 1 0 1]
|
|
503
|
+
sage: facets.matrix().transpose() == Vrep.matrix()
|
|
504
|
+
True
|
|
505
|
+
"""
|
|
506
|
+
from sage.rings.integer_ring import ZZ
|
|
507
|
+
from sage.matrix.constructor import matrix
|
|
508
|
+
cdef Matrix_dense M = matrix(
|
|
509
|
+
ZZ, self.n_faces(), self.n_atoms(), 0)
|
|
510
|
+
|
|
511
|
+
cdef size_t i
|
|
512
|
+
cdef long j
|
|
513
|
+
try:
|
|
514
|
+
for i in range(self.n_faces()):
|
|
515
|
+
j = face_next_atom(self.data.faces[i], 0)
|
|
516
|
+
while j != -1:
|
|
517
|
+
M.set_unsafe_int(i, j, 1)
|
|
518
|
+
j = face_next_atom(self.data.faces[i], j+1)
|
|
519
|
+
except AttributeError:
|
|
520
|
+
# Fall back to general matrix API
|
|
521
|
+
for i in range(self.n_faces()):
|
|
522
|
+
j = face_next_atom(self.data.faces[i], 0)
|
|
523
|
+
while j != -1:
|
|
524
|
+
M[i, j] = 1
|
|
525
|
+
j = face_next_atom(self.data.faces[i], j+1)
|
|
526
|
+
|
|
527
|
+
M.set_immutable()
|
|
528
|
+
return M
|
|
529
|
+
|
|
530
|
+
cdef tuple face_as_combinatorial_polyhedron(ListOfFaces facets, ListOfFaces Vrep, face_t face, bint dual):
|
|
531
|
+
r"""
|
|
532
|
+
Obtain facets and Vrepresentation of ``face`` as new combinatorial polyhedron.
|
|
533
|
+
|
|
534
|
+
INPUT:
|
|
535
|
+
|
|
536
|
+
- ``facets`` -- facets of the polyhedron
|
|
537
|
+
- ``Vrep`` -- Vrepresentation of the polyhedron
|
|
538
|
+
- ``face`` -- face in Vrepresentation or ``NULL``
|
|
539
|
+
- ``dual`` -- boolean
|
|
540
|
+
|
|
541
|
+
OUTPUT: a tuple of new facets and new Vrepresentation as :class:`ListOfFaces`.
|
|
542
|
+
"""
|
|
543
|
+
cdef ListOfFaces new_facets, new_Vrep
|
|
544
|
+
cdef bint* delete
|
|
545
|
+
cdef MemoryAllocator mem = MemoryAllocator()
|
|
546
|
+
cdef size_t i
|
|
547
|
+
cdef face_t null_face
|
|
548
|
+
|
|
549
|
+
# Delete all atoms not in the face.
|
|
550
|
+
if not dual:
|
|
551
|
+
new_facets = facets.delete_atoms_unsafe(NULL, face)
|
|
552
|
+
new_Vrep = Vrep.__copy__()
|
|
553
|
+
new_Vrep.delete_faces_unsafe(NULL, face)
|
|
554
|
+
|
|
555
|
+
delete = <bint*> mem.allocarray(new_facets.n_faces(), sizeof(bint))
|
|
556
|
+
else:
|
|
557
|
+
delete = <bint*> mem.allocarray(max(facets.n_faces(), facets.n_atoms()), sizeof(bint))
|
|
558
|
+
|
|
559
|
+
# Set ``delete[i]`` to one if ``i`` is not a vertex of ``face``.
|
|
560
|
+
for i in range(Vrep.n_faces()):
|
|
561
|
+
if face_issubset(face, Vrep.data.faces[i]):
|
|
562
|
+
delete[i] = 0
|
|
563
|
+
else:
|
|
564
|
+
delete[i] = 1
|
|
565
|
+
|
|
566
|
+
new_facets = facets.delete_atoms_unsafe(delete, null_face)
|
|
567
|
+
new_Vrep = Vrep.__copy__()
|
|
568
|
+
new_Vrep.delete_faces_unsafe(delete, null_face)
|
|
569
|
+
|
|
570
|
+
# Delete all facets that define the face.
|
|
571
|
+
new_facets.get_faces_all_set_unsafe(delete)
|
|
572
|
+
new_facets.delete_faces_unsafe(delete, null_face)
|
|
573
|
+
new_Vrep = new_Vrep.delete_atoms_unsafe(delete, null_face)
|
|
574
|
+
|
|
575
|
+
# Now delete all facets that are not inclusion maximal.
|
|
576
|
+
# the last copy of each duplicate will remain.
|
|
577
|
+
new_facets.get_not_inclusion_maximal_unsafe(delete)
|
|
578
|
+
new_facets.delete_faces_unsafe(delete, null_face)
|
|
579
|
+
new_Vrep = new_Vrep.delete_atoms_unsafe(delete, null_face)
|
|
580
|
+
|
|
581
|
+
# Finally set coatoms of the output.
|
|
582
|
+
for i in range(new_facets.n_faces()):
|
|
583
|
+
facet_set_coatom(new_facets.data.faces[i], i)
|
|
584
|
+
for i in range(new_Vrep.n_faces()):
|
|
585
|
+
facet_set_coatom(new_Vrep.data.faces[i], i)
|
|
586
|
+
|
|
587
|
+
return (new_facets, new_Vrep)
|
|
Binary file
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# sage_setup: distribution = sagemath-polyhedra
|
|
2
|
+
cimport cython
|
|
3
|
+
from sage.geometry.polyhedron.combinatorial_polyhedron.list_of_faces cimport ListOfFaces
|
|
4
|
+
from sage.geometry.polyhedron.combinatorial_polyhedron.face_data_structure cimport face_t
|
|
5
|
+
from sage.geometry.polyhedron.combinatorial_polyhedron.face_list_data_structure cimport face_list_t
|
|
6
|
+
from sage.geometry.polyhedron.combinatorial_polyhedron.combinatorial_face cimport CombinatorialFace
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
@cython.final
|
|
10
|
+
cdef class PolyhedronFaceLattice:
|
|
11
|
+
cdef int dimension # dimension of Polyhedron
|
|
12
|
+
cdef readonly bint dual # if True, then List of all faces by dual Polyhedron
|
|
13
|
+
cdef size_t *f_vector # a copy of the f-vector, is reversed if dual
|
|
14
|
+
cdef size_t *atom_rep # a place where atom-representation of face will be stored
|
|
15
|
+
cdef size_t *coatom_rep # a place where coatom-representation of face will be stored
|
|
16
|
+
|
|
17
|
+
# some copies from CombinatorialPolyhedron
|
|
18
|
+
cdef tuple _Vrep, _facet_names, _equations
|
|
19
|
+
cdef bint _bounded
|
|
20
|
+
|
|
21
|
+
# Atoms and coatoms are the Vrep/facets of the Polyedron.
|
|
22
|
+
# If ``dual == 0``, then coatoms are facets, atoms Vrepresentatives and vice versa.
|
|
23
|
+
cdef ListOfFaces atoms, coatoms
|
|
24
|
+
|
|
25
|
+
# All faces are stored in ``faces``. ``faces[i]`` stores all faces of
|
|
26
|
+
# dimension `i` in Bit-representation (of atoms).
|
|
27
|
+
cdef face_list_t *faces
|
|
28
|
+
|
|
29
|
+
# It follows a number of attributes to iterate over all incidences.
|
|
30
|
+
# After initialization, ``PolyhedronFaceLattice`` can iterate over all incidences
|
|
31
|
+
# of faces of dimension ``incidence_dim_one`` and ``incidence_dim_two``.
|
|
32
|
+
cdef int is_incidence_initialized
|
|
33
|
+
cdef int incidence_dim_one
|
|
34
|
+
cdef int incidence_dim_two
|
|
35
|
+
cdef size_t incidence_counter_one # walks through faces of incidence_dim_one
|
|
36
|
+
cdef size_t incidence_counter_two # walks through all indices of coatoms (for each face in incidence_dim_one)
|
|
37
|
+
|
|
38
|
+
# Intersection of ``faces[incidence_dim_one][incidence_counter_one]`` with
|
|
39
|
+
# ``coatoms[incidence_counter_two]``.
|
|
40
|
+
# If this is contained in ``faces[incidence_dim_two]``, there is an incidence.
|
|
41
|
+
cdef face_t incidence_face
|
|
42
|
+
|
|
43
|
+
cdef int _sort(self) except -1
|
|
44
|
+
cdef inline size_t find_face(self, int dimension, face_t face) except -2
|
|
45
|
+
cpdef CombinatorialFace get_face(self, int dimension, size_t index)
|
|
46
|
+
cdef size_t set_coatom_rep(self, int dimension, size_t index) except -1
|
|
47
|
+
cdef size_t set_atom_rep(self, int dimension, size_t index) except -1
|
|
48
|
+
cdef void incidence_init(self, int dimension_one, int dimension_two) noexcept
|
|
49
|
+
cdef inline bint next_incidence(self, size_t *one, size_t *two) noexcept
|
|
50
|
+
cdef inline bint next_incidence_loop(self, size_t *one, size_t *two) noexcept
|
|
51
|
+
cdef inline bint next_trivial_incidence(self, size_t *one, size_t *two) noexcept
|
|
52
|
+
cdef inline bint next_trivial_incidence2(self, size_t *one, size_t *two) noexcept
|