passagemath-polyhedra 10.6.31rc3__cp314-cp314-musllinux_1_2_aarch64.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-2d945d6c.so.1 +0 -0
- passagemath_polyhedra.libs/libgmp-28992bcb.so.10.5.0 +0 -0
- passagemath_polyhedra.libs/libgomp-1ede7ee7.so.1.0.0 +0 -0
- passagemath_polyhedra.libs/libstdc++-85f2cd6d.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-aarch64-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-aarch64-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-aarch64-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-aarch64-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-aarch64-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-aarch64-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-aarch64-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-aarch64-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-aarch64-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-aarch64-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-aarch64-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-aarch64-linux-musl.so +0 -0
- sage/numerical/backends/cvxopt_sdp_backend.pyx +382 -0
- sage/numerical/backends/cvxpy_backend.cpython-314-aarch64-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-aarch64-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-aarch64-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-aarch64-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-aarch64-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-aarch64-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-aarch64-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-aarch64-linux-musl.so +0 -0
- sage/numerical/mip.pxd +40 -0
- sage/numerical/mip.pyx +3667 -0
- sage/numerical/sdp.cpython-314-aarch64-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-aarch64-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
sage/geometry/polyhedron/combinatorial_polyhedron/conversions.cpython-314-aarch64-linux-musl.so
ADDED
|
Binary file
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# sage_setup: distribution = sagemath-polyhedra
|
|
2
|
+
from sage.geometry.polyhedron.combinatorial_polyhedron.face_list_data_structure cimport face_t
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
cdef int Vrep_list_to_bit_rep(tuple Vrep_list, face_t output) except -1
|
|
6
|
+
|
|
7
|
+
cdef int incidences_to_bit_rep(tuple incidences, face_t output) except -1
|
|
8
|
+
|
|
9
|
+
cdef size_t bit_rep_to_Vrep_list(face_t face, size_t *output) except -1
|
|
@@ -0,0 +1,501 @@
|
|
|
1
|
+
# sage_setup: distribution = sagemath-polyhedra
|
|
2
|
+
r"""
|
|
3
|
+
Conversions
|
|
4
|
+
|
|
5
|
+
This module provides conversions to :class:`~sage.geometry.polyhedron.combinatorial_polyhedron.list_of_faces.ListOfFaces` from
|
|
6
|
+
- an incidence matrix of a polyhedron or
|
|
7
|
+
- a tuple of facets (as tuple of vertices each).
|
|
8
|
+
|
|
9
|
+
Also this module provides a conversion from the data of :class:`~sage.geometry.polyhedron.combinatorial_polyhedron.list_of_faces.ListOfFaces`,
|
|
10
|
+
which is a Bit-vector representing incidences of a face,
|
|
11
|
+
to a list of entries which are incident.
|
|
12
|
+
|
|
13
|
+
.. SEEALSO::
|
|
14
|
+
|
|
15
|
+
:mod:`~sage.geometry.polyhedron.combinatorial_polyhedron.list_of_faces`,
|
|
16
|
+
:mod:`~sage.geometry.polyhedron.combinatorial_polyhedron.face_iterator`,
|
|
17
|
+
:mod:`~sage.geometry.polyhedron.combinatorial_polyhedron.base`.
|
|
18
|
+
|
|
19
|
+
EXAMPLES:
|
|
20
|
+
|
|
21
|
+
Obtain the facets of a polyhedron as :class:`~sage.geometry.polyhedron.combinatorial_polyhedron.list_of_faces.ListOfFaces`::
|
|
22
|
+
|
|
23
|
+
sage: from sage.geometry.polyhedron.combinatorial_polyhedron.conversions \
|
|
24
|
+
....: import incidence_matrix_to_bit_rep_of_facets
|
|
25
|
+
sage: P = polytopes.simplex(4)
|
|
26
|
+
sage: inc = P.incidence_matrix()
|
|
27
|
+
sage: mod_inc = inc.delete_columns([i for i,V in enumerate(P.Hrepresentation()) if V.is_equation()])
|
|
28
|
+
sage: face_list = incidence_matrix_to_bit_rep_of_facets(mod_inc)
|
|
29
|
+
sage: face_list.compute_dimension()
|
|
30
|
+
4
|
|
31
|
+
|
|
32
|
+
Obtain the Vrepresentation of a polyhedron as facet-incidences stored in
|
|
33
|
+
:class:`~sage.geometry.polyhedron.combinatorial_polyhedron.list_of_faces.ListOfFaces`::
|
|
34
|
+
|
|
35
|
+
sage: # needs sage.combinat
|
|
36
|
+
sage: from sage.geometry.polyhedron.combinatorial_polyhedron.conversions \
|
|
37
|
+
....: import incidence_matrix_to_bit_rep_of_Vrep
|
|
38
|
+
sage: P = polytopes.associahedron(['A',4])
|
|
39
|
+
sage: face_list = incidence_matrix_to_bit_rep_of_Vrep(P.incidence_matrix())
|
|
40
|
+
sage: face_list.compute_dimension()
|
|
41
|
+
4
|
|
42
|
+
|
|
43
|
+
Obtain the facets of a polyhedron as :class:`~sage.geometry.polyhedron.combinatorial_polyhedron.list_of_faces.ListOfFaces` from a facet list::
|
|
44
|
+
|
|
45
|
+
sage: from sage.geometry.polyhedron.combinatorial_polyhedron.conversions \
|
|
46
|
+
....: import facets_tuple_to_bit_rep_of_facets
|
|
47
|
+
sage: facets = ((0,1,2), (0,1,3), (0,2,3), (1,2,3))
|
|
48
|
+
sage: face_list = facets_tuple_to_bit_rep_of_facets(facets, 4)
|
|
49
|
+
|
|
50
|
+
Likewise for the Vrep as facet-incidences::
|
|
51
|
+
|
|
52
|
+
sage: from sage.geometry.polyhedron.combinatorial_polyhedron.conversions \
|
|
53
|
+
....: import facets_tuple_to_bit_rep_of_Vrep
|
|
54
|
+
sage: facets = ((0,1,2), (0,1,3), (0,2,3), (1,2,3))
|
|
55
|
+
sage: face_list = facets_tuple_to_bit_rep_of_Vrep(facets, 4)
|
|
56
|
+
|
|
57
|
+
AUTHOR:
|
|
58
|
+
|
|
59
|
+
- Jonathan Kliem (2019-04)
|
|
60
|
+
"""
|
|
61
|
+
|
|
62
|
+
# ****************************************************************************
|
|
63
|
+
# Copyright (C) 2019 Jonathan Kliem <jonathan.kliem@gmail.com>
|
|
64
|
+
#
|
|
65
|
+
# This program is free software: you can redistribute it and/or modify
|
|
66
|
+
# it under the terms of the GNU General Public License as published by
|
|
67
|
+
# the Free Software Foundation, either version 2 of the License, or
|
|
68
|
+
# (at your option) any later version.
|
|
69
|
+
# https://www.gnu.org/licenses/
|
|
70
|
+
# ****************************************************************************
|
|
71
|
+
|
|
72
|
+
from memory_allocator cimport MemoryAllocator
|
|
73
|
+
|
|
74
|
+
from sage.matrix.matrix_dense cimport Matrix_dense
|
|
75
|
+
|
|
76
|
+
from sage.geometry.polyhedron.combinatorial_polyhedron.list_of_faces cimport ListOfFaces
|
|
77
|
+
from sage.geometry.polyhedron.combinatorial_polyhedron.face_data_structure cimport face_next_atom, face_add_atom_safe, facet_set_coatom, face_clear
|
|
78
|
+
|
|
79
|
+
cdef extern from "Python.h":
|
|
80
|
+
int unlikely(int) nogil # Defined by Cython
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
def _Vrep_list_to_bit_rep_wrapper(tup):
|
|
84
|
+
r"""
|
|
85
|
+
A function to allow doctesting of :func:`Vrep_list_to_bit_rep`.
|
|
86
|
+
|
|
87
|
+
TESTS::
|
|
88
|
+
|
|
89
|
+
sage: from sage.geometry.polyhedron.combinatorial_polyhedron.conversions \
|
|
90
|
+
....: import _Vrep_list_to_bit_rep_wrapper
|
|
91
|
+
sage: _Vrep_list_to_bit_rep_wrapper((0, 3)).matrix()
|
|
92
|
+
[1 0 0 1]
|
|
93
|
+
"""
|
|
94
|
+
cdef ListOfFaces output = ListOfFaces(1, max(tup) + 1, 1)
|
|
95
|
+
Vrep_list_to_bit_rep(tup, output.data.faces[0])
|
|
96
|
+
return output
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
cdef int Vrep_list_to_bit_rep(tuple Vrep_list, face_t output) except -1:
|
|
100
|
+
r"""
|
|
101
|
+
Convert a vertex list into Bit-representation. Store it in ``output``.
|
|
102
|
+
|
|
103
|
+
The first bit represents the entry ``0`` and is set to one, iff ``0`` is in
|
|
104
|
+
``vertex_list``. The second bit represents ``1`` and so on.
|
|
105
|
+
|
|
106
|
+
INPUT:
|
|
107
|
+
|
|
108
|
+
- ``vertex_list`` -- tuple of pairwise distinct positive integers that fit into ``output``
|
|
109
|
+
- ``output`` -- an already initialized face
|
|
110
|
+
|
|
111
|
+
OUTPUT: ``output`` is filled
|
|
112
|
+
|
|
113
|
+
EXAMPLES::
|
|
114
|
+
|
|
115
|
+
sage: from sage.geometry.polyhedron.combinatorial_polyhedron.conversions \
|
|
116
|
+
....: import _Vrep_list_to_bit_rep_wrapper
|
|
117
|
+
sage: _Vrep_list_to_bit_rep_wrapper((0, 1)).matrix()
|
|
118
|
+
[1 1]
|
|
119
|
+
sage: _Vrep_list_to_bit_rep_wrapper((0, 2, 66)).matrix().nonzero_positions_in_row(0)
|
|
120
|
+
[0, 2, 66]
|
|
121
|
+
sage: _Vrep_list_to_bit_rep_wrapper((-1, 12))
|
|
122
|
+
Traceback (most recent call last):
|
|
123
|
+
...
|
|
124
|
+
OverflowError: can...t convert negative value to size_t
|
|
125
|
+
sage: _Vrep_list_to_bit_rep_wrapper((0, 0))
|
|
126
|
+
Traceback (most recent call last):
|
|
127
|
+
...
|
|
128
|
+
ValueError: entries of ``tup`` are not distinct
|
|
129
|
+
"""
|
|
130
|
+
cdef size_t entry # will iterate over tup
|
|
131
|
+
|
|
132
|
+
face_clear(output)
|
|
133
|
+
if unlikely(len(Vrep_list) != len(set(Vrep_list))):
|
|
134
|
+
raise ValueError("entries of ``tup`` are not distinct")
|
|
135
|
+
for entry in Vrep_list:
|
|
136
|
+
face_add_atom_safe(output, entry)
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
def _incidences_to_bit_rep_wrapper(tup):
|
|
140
|
+
r"""
|
|
141
|
+
A function to allow doctesting of :func:`incidences_to_bit_rep`.
|
|
142
|
+
|
|
143
|
+
TESTS::
|
|
144
|
+
|
|
145
|
+
sage: from sage.geometry.polyhedron.combinatorial_polyhedron.conversions \
|
|
146
|
+
....: import _incidences_to_bit_rep_wrapper
|
|
147
|
+
sage: _incidences_to_bit_rep_wrapper((1,0,0,1)).matrix()
|
|
148
|
+
[1 0 0 1]
|
|
149
|
+
"""
|
|
150
|
+
cdef ListOfFaces output = ListOfFaces(1, len(tup), 1)
|
|
151
|
+
incidences_to_bit_rep(tup, output.data.faces[0])
|
|
152
|
+
return output
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
cdef int incidences_to_bit_rep(tuple incidences, face_t output) except -1:
|
|
156
|
+
r"""
|
|
157
|
+
Convert a tuple of incidences into Bit-representation.
|
|
158
|
+
|
|
159
|
+
Store it in ``output``. Each entry in ``incidences`` represents a bit in
|
|
160
|
+
``output``. It is set to ``1``, iff the entry in ``incidences`` is nonzero.
|
|
161
|
+
|
|
162
|
+
INPUT:
|
|
163
|
+
|
|
164
|
+
- ``incidences`` -- tuple of integers representing incidences that fit into ``output``
|
|
165
|
+
- ``output`` -- an already initialized face
|
|
166
|
+
|
|
167
|
+
OUTPUT: ``output`` is filled
|
|
168
|
+
|
|
169
|
+
EXAMPLES::
|
|
170
|
+
|
|
171
|
+
sage: from sage.geometry.polyhedron.combinatorial_polyhedron.conversions \
|
|
172
|
+
....: import _incidences_to_bit_rep_wrapper
|
|
173
|
+
sage: _incidences_to_bit_rep_wrapper((1,1)).matrix()
|
|
174
|
+
[1 1]
|
|
175
|
+
sage: _incidences_to_bit_rep_wrapper((1,0,1) + 61*(0,) +
|
|
176
|
+
....: (0,0,1,)).matrix().nonzero_positions_in_row(0)
|
|
177
|
+
[0, 2, 66]
|
|
178
|
+
"""
|
|
179
|
+
cdef size_t entry # index for the entries in tup
|
|
180
|
+
cdef size_t length = len(incidences)
|
|
181
|
+
|
|
182
|
+
face_clear(output)
|
|
183
|
+
for entry in range(length):
|
|
184
|
+
if incidences[entry]:
|
|
185
|
+
# Vrep ``entry`` is contained in the face, so set the corresponding bit
|
|
186
|
+
face_add_atom_safe(output, entry)
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
def incidence_matrix_to_bit_rep_of_facets(Matrix_dense matrix):
|
|
190
|
+
r"""
|
|
191
|
+
Initialize facets in Bit-representation as :class:`~sage.geometry.polyhedron.combinatorial_polyhedron.list_of_faces.ListOfFaces`.
|
|
192
|
+
|
|
193
|
+
INPUT:
|
|
194
|
+
|
|
195
|
+
- ``matrix`` -- an incidence matrix as in
|
|
196
|
+
:meth:`sage.geometry.polyhedron.base.Polyhedron_base.incidence_matrix`
|
|
197
|
+
with columns corresponding to equations deleted
|
|
198
|
+
of type :class:`sage.matrix.matrix_dense.Matrix_dense`
|
|
199
|
+
|
|
200
|
+
OUTPUT: :class:`~sage.geometry.polyhedron.combinatorial_polyhedron.list_of_faces.ListOfFaces`
|
|
201
|
+
|
|
202
|
+
EXAMPLES::
|
|
203
|
+
|
|
204
|
+
sage: from sage.geometry.polyhedron.combinatorial_polyhedron.conversions \
|
|
205
|
+
....: import incidence_matrix_to_bit_rep_of_facets, \
|
|
206
|
+
....: _bit_rep_to_Vrep_list_wrapper
|
|
207
|
+
sage: P = polytopes.permutahedron(4)
|
|
208
|
+
sage: inc = P.incidence_matrix()
|
|
209
|
+
sage: mod_inc = inc.delete_columns([i for i,V in enumerate(P.Hrepresentation()) if V.is_equation()])
|
|
210
|
+
sage: facets = incidence_matrix_to_bit_rep_of_facets(mod_inc)
|
|
211
|
+
sage: facets.matrix().dimensions()
|
|
212
|
+
(14, 24)
|
|
213
|
+
sage: for row in facets.matrix():
|
|
214
|
+
....: row.nonzero_positions()
|
|
215
|
+
[18, 19, 20, 21, 22, 23]
|
|
216
|
+
[3, 5, 8, 10, 12, 17]
|
|
217
|
+
[2, 7, 11, 13, 20, 21]
|
|
218
|
+
[2, 5, 12, 13]
|
|
219
|
+
[4, 6, 14, 15, 19, 23]
|
|
220
|
+
[3, 4, 8, 14]
|
|
221
|
+
[6, 7, 21, 23]
|
|
222
|
+
[2, 3, 4, 5, 6, 7]
|
|
223
|
+
[0, 1, 9, 16, 18, 22]
|
|
224
|
+
[0, 9, 10, 17]
|
|
225
|
+
[1, 11, 20, 22]
|
|
226
|
+
[0, 1, 10, 11, 12, 13]
|
|
227
|
+
[15, 16, 18, 19]
|
|
228
|
+
[8, 9, 14, 15, 16, 17]
|
|
229
|
+
"""
|
|
230
|
+
# Output will be a ``ListOfFaces`` with ``matrix.ncols()`` faces and
|
|
231
|
+
# ``matrix.nrows()`` Vrep.
|
|
232
|
+
cdef size_t nrows = matrix.nrows()
|
|
233
|
+
cdef size_t ncols = matrix.ncols()
|
|
234
|
+
cdef ListOfFaces facets = ListOfFaces(ncols, nrows, ncols)
|
|
235
|
+
cdef face_t output
|
|
236
|
+
cdef size_t entry # index for the entries in tup
|
|
237
|
+
|
|
238
|
+
cdef size_t i
|
|
239
|
+
try:
|
|
240
|
+
for i in range(ncols):
|
|
241
|
+
output = facets.data.faces[i]
|
|
242
|
+
facet_set_coatom(output, i)
|
|
243
|
+
|
|
244
|
+
# Filling each facet with its Vrep-incidences, which "is" the
|
|
245
|
+
# "i-th column" of the original matrix (but we have transposed).
|
|
246
|
+
for entry in range(nrows):
|
|
247
|
+
if not matrix.get_is_zero_unsafe(entry, i):
|
|
248
|
+
# Vrep ``entry`` is contained in the face, so set the corresponding bit
|
|
249
|
+
face_add_atom_safe(output, entry)
|
|
250
|
+
except AttributeError:
|
|
251
|
+
# fall back to using general matrix API
|
|
252
|
+
for i in range(ncols):
|
|
253
|
+
output = facets.data.faces[i]
|
|
254
|
+
facet_set_coatom(output, i)
|
|
255
|
+
for entry in range(nrows):
|
|
256
|
+
if matrix[entry, i]:
|
|
257
|
+
face_add_atom_safe(output, entry)
|
|
258
|
+
return facets
|
|
259
|
+
|
|
260
|
+
|
|
261
|
+
def incidence_matrix_to_bit_rep_of_Vrep(Matrix_dense matrix):
|
|
262
|
+
r"""
|
|
263
|
+
Initialize Vrepresentatives in Bit-representation as :class:`~sage.geometry.polyhedron.combinatorial_polyhedron.list_of_faces.ListOfFaces`.
|
|
264
|
+
|
|
265
|
+
Each Vrepresentative is represented as the facets it is contained in.
|
|
266
|
+
Those are the facets of the polar polyhedron, if it exists.
|
|
267
|
+
|
|
268
|
+
INPUT:
|
|
269
|
+
|
|
270
|
+
- ``matrix`` -- an incidence matrix as in
|
|
271
|
+
:meth:`sage.geometry.polyhedron.base.Polyhedron_base.incidence_matrix`
|
|
272
|
+
with columns corresponding to equations deleted
|
|
273
|
+
of type :class:`sage.matrix.matrix_dense.Matrix_dense`
|
|
274
|
+
|
|
275
|
+
OUTPUT: :class:`~sage.geometry.polyhedron.combinatorial_polyhedron.list_of_faces.ListOfFaces`
|
|
276
|
+
|
|
277
|
+
EXAMPLES::
|
|
278
|
+
|
|
279
|
+
sage: from sage.geometry.polyhedron.combinatorial_polyhedron.conversions \
|
|
280
|
+
....: import incidence_matrix_to_bit_rep_of_Vrep, \
|
|
281
|
+
....: _bit_rep_to_Vrep_list_wrapper
|
|
282
|
+
sage: P = polytopes.permutahedron(4)
|
|
283
|
+
sage: inc = P.incidence_matrix()
|
|
284
|
+
sage: mod_inc = inc.delete_columns([i for i,V in enumerate(P.Hrepresentation()) if V.is_equation()])
|
|
285
|
+
sage: vertices = incidence_matrix_to_bit_rep_of_Vrep(mod_inc)
|
|
286
|
+
sage: vertices.matrix().dimensions()
|
|
287
|
+
(24, 14)
|
|
288
|
+
sage: for row in vertices.matrix():
|
|
289
|
+
....: row.nonzero_positions()
|
|
290
|
+
[8, 9, 11]
|
|
291
|
+
[8, 10, 11]
|
|
292
|
+
[2, 3, 7]
|
|
293
|
+
[1, 5, 7]
|
|
294
|
+
[4, 5, 7]
|
|
295
|
+
[1, 3, 7]
|
|
296
|
+
[4, 6, 7]
|
|
297
|
+
[2, 6, 7]
|
|
298
|
+
[1, 5, 13]
|
|
299
|
+
[8, 9, 13]
|
|
300
|
+
[1, 9, 11]
|
|
301
|
+
[2, 10, 11]
|
|
302
|
+
[1, 3, 11]
|
|
303
|
+
[2, 3, 11]
|
|
304
|
+
[4, 5, 13]
|
|
305
|
+
[4, 12, 13]
|
|
306
|
+
[8, 12, 13]
|
|
307
|
+
[1, 9, 13]
|
|
308
|
+
[0, 8, 12]
|
|
309
|
+
[0, 4, 12]
|
|
310
|
+
[0, 2, 10]
|
|
311
|
+
[0, 2, 6]
|
|
312
|
+
[0, 8, 10]
|
|
313
|
+
[0, 4, 6]
|
|
314
|
+
"""
|
|
315
|
+
return incidence_matrix_to_bit_rep_of_facets(matrix.transpose())
|
|
316
|
+
|
|
317
|
+
|
|
318
|
+
def facets_tuple_to_bit_rep_of_facets(tuple facets_input, size_t n_Vrep):
|
|
319
|
+
r"""
|
|
320
|
+
Initialize facets in Bit-representation as :class:`~sage.geometry.polyhedron.combinatorial_polyhedron.list_of_faces.ListOfFaces`.
|
|
321
|
+
|
|
322
|
+
INPUT:
|
|
323
|
+
|
|
324
|
+
- ``facets_input`` -- tuple of facets, each facet a tuple of Vrep,
|
|
325
|
+
Vrep must be exactly ``range(n_Vrep)``
|
|
326
|
+
- ``n_Vrep``
|
|
327
|
+
|
|
328
|
+
OUTPUT: :class:`~sage.geometry.polyhedron.combinatorial_polyhedron.list_of_faces.ListOfFaces`
|
|
329
|
+
|
|
330
|
+
EXAMPLES::
|
|
331
|
+
|
|
332
|
+
sage: from sage.geometry.polyhedron.combinatorial_polyhedron.conversions \
|
|
333
|
+
....: import facets_tuple_to_bit_rep_of_facets, \
|
|
334
|
+
....: _bit_rep_to_Vrep_list_wrapper
|
|
335
|
+
sage: bi_pyr = ((0,1,4), (1,2,4), (2,3,4), (3,0,4),
|
|
336
|
+
....: (0,1,5), (1,2,5), (2,3,5), (3,0,5))
|
|
337
|
+
sage: facets = facets_tuple_to_bit_rep_of_facets(bi_pyr, 6)
|
|
338
|
+
sage: for i in range(8):
|
|
339
|
+
....: print(_bit_rep_to_Vrep_list_wrapper(facets, i))
|
|
340
|
+
(0, 1, 4)
|
|
341
|
+
(1, 2, 4)
|
|
342
|
+
(2, 3, 4)
|
|
343
|
+
(0, 3, 4)
|
|
344
|
+
(0, 1, 5)
|
|
345
|
+
(1, 2, 5)
|
|
346
|
+
(2, 3, 5)
|
|
347
|
+
(0, 3, 5)
|
|
348
|
+
"""
|
|
349
|
+
cdef Py_ssize_t i
|
|
350
|
+
cdef ListOfFaces facets = ListOfFaces(len(facets_input), n_Vrep, len(facets_input))
|
|
351
|
+
for i in range(len(facets_input)):
|
|
352
|
+
# filling each facet with the data from the corresponding facet
|
|
353
|
+
Vrep_list_to_bit_rep(facets_input[i], facets.data.faces[i])
|
|
354
|
+
facet_set_coatom(facets.data.faces[i], i)
|
|
355
|
+
return facets
|
|
356
|
+
|
|
357
|
+
|
|
358
|
+
def facets_tuple_to_bit_rep_of_Vrep(tuple facets_input, size_t n_Vrep):
|
|
359
|
+
r"""
|
|
360
|
+
Initialize Vrepresentatives in Bit-representation as :class:`~sage.geometry.polyhedron.combinatorial_polyhedron.list_of_faces.ListOfFaces`.
|
|
361
|
+
|
|
362
|
+
Each Vrepresentative is represented as the facets it is contained in.
|
|
363
|
+
Those are the facets of the polar polyhedron, if it exists.
|
|
364
|
+
|
|
365
|
+
INPUT:
|
|
366
|
+
|
|
367
|
+
- ``facets_input`` -- tuple of facets, each facet a tuple of Vrep,
|
|
368
|
+
Vrep must be exactly ``range(n_Vrep)``
|
|
369
|
+
- ``n_Vrep``
|
|
370
|
+
|
|
371
|
+
OUTPUT: :class:`~sage.geometry.polyhedron.combinatorial_polyhedron.list_of_faces.ListOfFaces`
|
|
372
|
+
|
|
373
|
+
EXAMPLES::
|
|
374
|
+
|
|
375
|
+
sage: from sage.geometry.polyhedron.combinatorial_polyhedron.conversions \
|
|
376
|
+
....: import facets_tuple_to_bit_rep_of_Vrep, \
|
|
377
|
+
....: _bit_rep_to_Vrep_list_wrapper
|
|
378
|
+
sage: bi_pyr = ((0,1,4), (1,2,4), (2,3,4), (3,0,4),
|
|
379
|
+
....: (0,1,5), (1,2,5), (2,3,5), (3,0,5))
|
|
380
|
+
sage: vertices = facets_tuple_to_bit_rep_of_Vrep(bi_pyr, 6)
|
|
381
|
+
sage: for i in range(6):
|
|
382
|
+
....: print(_bit_rep_to_Vrep_list_wrapper(vertices, i))
|
|
383
|
+
(0, 3, 4, 7)
|
|
384
|
+
(0, 1, 4, 5)
|
|
385
|
+
(1, 2, 5, 6)
|
|
386
|
+
(2, 3, 6, 7)
|
|
387
|
+
(0, 1, 2, 3)
|
|
388
|
+
(4, 5, 6, 7)
|
|
389
|
+
"""
|
|
390
|
+
cdef size_t n_facets = len(facets_input)
|
|
391
|
+
|
|
392
|
+
# Vertices in facet-representation will be a ``ListOfFaces``
|
|
393
|
+
# with number of Vrep faces and
|
|
394
|
+
# number of facets "Vrep"/atoms.
|
|
395
|
+
cdef ListOfFaces Vrep = ListOfFaces(n_Vrep, n_facets, n_Vrep)
|
|
396
|
+
cdef face_t* Vrep_data = Vrep.data.faces
|
|
397
|
+
|
|
398
|
+
# Initializing the data of ListOfFaces.
|
|
399
|
+
|
|
400
|
+
cdef size_t input_facet # will iterate over indices of facets_input
|
|
401
|
+
cdef size_t input_Vrep # will iterate over vertices in facet ``input_facet``
|
|
402
|
+
cdef size_t i
|
|
403
|
+
|
|
404
|
+
for i in range(n_Vrep):
|
|
405
|
+
facet_set_coatom(Vrep_data[i], i)
|
|
406
|
+
|
|
407
|
+
for input_facet in range(n_facets):
|
|
408
|
+
for input_Vrep in facets_input[input_facet]:
|
|
409
|
+
# Iff the input-Vrep is in the input-facet,
|
|
410
|
+
# then in facet-representation of the Vrep
|
|
411
|
+
# input-facet is a Vrep of intput-Vrep.
|
|
412
|
+
face_add_atom_safe(Vrep_data[input_Vrep], input_facet)
|
|
413
|
+
return Vrep
|
|
414
|
+
|
|
415
|
+
|
|
416
|
+
def _bit_rep_to_Vrep_list_wrapper(ListOfFaces faces, index=0):
|
|
417
|
+
r"""
|
|
418
|
+
A function to test :func:`bit_rep_to_Vrep_list`.
|
|
419
|
+
|
|
420
|
+
INPUT:
|
|
421
|
+
|
|
422
|
+
- ``faces`` -- a :class:`~sage.geometry.polyhedron.combinatorial_polyhedron.list_of_faces.ListOfFaces`
|
|
423
|
+
- ``index`` -- (default: ``0``) the face to obtain
|
|
424
|
+
|
|
425
|
+
OUTPUT: the face as tuple of integers
|
|
426
|
+
|
|
427
|
+
EXAMPLES::
|
|
428
|
+
|
|
429
|
+
sage: from sage.geometry.polyhedron.combinatorial_polyhedron.conversions \
|
|
430
|
+
....: import facets_tuple_to_bit_rep_of_facets, \
|
|
431
|
+
....: _bit_rep_to_Vrep_list_wrapper
|
|
432
|
+
sage: faces = facets_tuple_to_bit_rep_of_facets(((1,5,123,1054),), 1055)
|
|
433
|
+
sage: _bit_rep_to_Vrep_list_wrapper(faces, 0)
|
|
434
|
+
(1, 5, 123, 1054)
|
|
435
|
+
"""
|
|
436
|
+
cdef MemoryAllocator mem = MemoryAllocator()
|
|
437
|
+
cdef size_t *output
|
|
438
|
+
output = <size_t *> mem.allocarray(faces.n_atoms(),
|
|
439
|
+
sizeof(size_t))
|
|
440
|
+
|
|
441
|
+
length = bit_rep_to_Vrep_list(faces.data.faces[index], output)
|
|
442
|
+
return tuple(output[i] for i in range(length))
|
|
443
|
+
|
|
444
|
+
|
|
445
|
+
cdef inline size_t bit_rep_to_Vrep_list(face_t face, size_t *output) except -1:
|
|
446
|
+
r"""
|
|
447
|
+
Convert a bitrep-representation to a list of Vrep. Return length of representation.
|
|
448
|
+
|
|
449
|
+
Basically this is an inverse to :meth:`Vrep_list_to_bit_rep`.
|
|
450
|
+
Instead of returning a tuple, it stores the Vrep in ``output``.
|
|
451
|
+
|
|
452
|
+
INPUT:
|
|
453
|
+
|
|
454
|
+
- ``face`` -- a Bit-representation of a face
|
|
455
|
+
- ``output`` -- an array of ``size_t`` long enough to contain all Vrep
|
|
456
|
+
of that face
|
|
457
|
+
|
|
458
|
+
OUTPUT:
|
|
459
|
+
|
|
460
|
+
- store Vrep in ``output``
|
|
461
|
+
- return "length" of ``output``
|
|
462
|
+
|
|
463
|
+
EXAMPLES::
|
|
464
|
+
|
|
465
|
+
sage: from sage.geometry.polyhedron.combinatorial_polyhedron.conversions \
|
|
466
|
+
....: import _bit_rep_to_Vrep_list_wrapper, \
|
|
467
|
+
....: _Vrep_list_to_bit_rep_wrapper
|
|
468
|
+
sage: faces = _Vrep_list_to_bit_rep_wrapper((0, 4, 64, 65, 66, 67, 68))
|
|
469
|
+
sage: _bit_rep_to_Vrep_list_wrapper(faces, 0)
|
|
470
|
+
(0, 4, 64, 65, 66, 67, 68)
|
|
471
|
+
sage: faces = _Vrep_list_to_bit_rep_wrapper((0, 2, 3))
|
|
472
|
+
sage: _bit_rep_to_Vrep_list_wrapper(faces, 0)
|
|
473
|
+
(0, 2, 3)
|
|
474
|
+
sage: faces = _Vrep_list_to_bit_rep_wrapper((64, 66, 67, 68, 69))
|
|
475
|
+
sage: _bit_rep_to_Vrep_list_wrapper(faces, 0)
|
|
476
|
+
(64, 66, 67, 68, 69)
|
|
477
|
+
|
|
478
|
+
TESTS:
|
|
479
|
+
|
|
480
|
+
Testing that :meth`bit_rep_to_Vrep_list` is the
|
|
481
|
+
inverse to :meth:`Vrep_list_to_bit_rep`::
|
|
482
|
+
|
|
483
|
+
sage: from sage.geometry.polyhedron.combinatorial_polyhedron.conversions \
|
|
484
|
+
....: import _bit_rep_to_Vrep_list_wrapper, \
|
|
485
|
+
....: _Vrep_list_to_bit_rep_wrapper
|
|
486
|
+
sage: for _ in range(10):
|
|
487
|
+
....: st = set(randint(0,127) for i in range(40))
|
|
488
|
+
....: tup = tuple(sorted(tuple(st)))
|
|
489
|
+
....: faces = _Vrep_list_to_bit_rep_wrapper(tup)
|
|
490
|
+
....: output = _bit_rep_to_Vrep_list_wrapper(faces, 0)
|
|
491
|
+
....: if not tup == output:
|
|
492
|
+
....: print('``bit_rep_to_Vrep_list`` does not behave',
|
|
493
|
+
....: 'as the inverse of ``Vrep_list_to_bit_rep``')
|
|
494
|
+
"""
|
|
495
|
+
cdef size_t output_length = 0
|
|
496
|
+
cdef long j = face_next_atom(face, 0)
|
|
497
|
+
while (j != -1):
|
|
498
|
+
output[output_length] = j
|
|
499
|
+
output_length += 1
|
|
500
|
+
j = face_next_atom(face, j+1)
|
|
501
|
+
return output_length
|