passagemath-polyhedra 10.6.31rc3__cp314-cp314-manylinux_2_24_x86_64.manylinux_2_28_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.

Files changed (206) hide show
  1. passagemath_polyhedra-10.6.31rc3.dist-info/METADATA +367 -0
  2. passagemath_polyhedra-10.6.31rc3.dist-info/METADATA.bak +369 -0
  3. passagemath_polyhedra-10.6.31rc3.dist-info/RECORD +206 -0
  4. passagemath_polyhedra-10.6.31rc3.dist-info/WHEEL +6 -0
  5. passagemath_polyhedra-10.6.31rc3.dist-info/top_level.txt +2 -0
  6. passagemath_polyhedra.libs/libgmp-6e109695.so.10.5.0 +0 -0
  7. passagemath_polyhedra.libs/libgomp-e985bcbb.so.1.0.0 +0 -0
  8. sage/all__sagemath_polyhedra.py +50 -0
  9. sage/game_theory/all.py +8 -0
  10. sage/game_theory/catalog.py +6 -0
  11. sage/game_theory/catalog_normal_form_games.py +923 -0
  12. sage/game_theory/cooperative_game.py +844 -0
  13. sage/game_theory/matching_game.py +1181 -0
  14. sage/game_theory/normal_form_game.py +2697 -0
  15. sage/game_theory/parser.py +275 -0
  16. sage/geometry/all__sagemath_polyhedra.py +22 -0
  17. sage/geometry/cone.py +6940 -0
  18. sage/geometry/cone_catalog.py +847 -0
  19. sage/geometry/cone_critical_angles.py +1027 -0
  20. sage/geometry/convex_set.py +1119 -0
  21. sage/geometry/fan.py +3743 -0
  22. sage/geometry/fan_isomorphism.py +389 -0
  23. sage/geometry/fan_morphism.py +1884 -0
  24. sage/geometry/hasse_diagram.py +202 -0
  25. sage/geometry/hyperplane_arrangement/affine_subspace.py +390 -0
  26. sage/geometry/hyperplane_arrangement/all.py +1 -0
  27. sage/geometry/hyperplane_arrangement/arrangement.py +3895 -0
  28. sage/geometry/hyperplane_arrangement/check_freeness.py +145 -0
  29. sage/geometry/hyperplane_arrangement/hyperplane.py +773 -0
  30. sage/geometry/hyperplane_arrangement/library.py +825 -0
  31. sage/geometry/hyperplane_arrangement/ordered_arrangement.py +642 -0
  32. sage/geometry/hyperplane_arrangement/plot.py +520 -0
  33. sage/geometry/integral_points.py +35 -0
  34. sage/geometry/integral_points_generic_dense.cpython-314-x86_64-linux-gnu.so +0 -0
  35. sage/geometry/integral_points_generic_dense.pyx +7 -0
  36. sage/geometry/lattice_polytope.py +5894 -0
  37. sage/geometry/linear_expression.py +773 -0
  38. sage/geometry/newton_polygon.py +767 -0
  39. sage/geometry/point_collection.cpython-314-x86_64-linux-gnu.so +0 -0
  40. sage/geometry/point_collection.pyx +1008 -0
  41. sage/geometry/polyhedral_complex.py +2616 -0
  42. sage/geometry/polyhedron/all.py +8 -0
  43. sage/geometry/polyhedron/backend_cdd.py +460 -0
  44. sage/geometry/polyhedron/backend_cdd_rdf.py +231 -0
  45. sage/geometry/polyhedron/backend_field.py +347 -0
  46. sage/geometry/polyhedron/backend_normaliz.py +2503 -0
  47. sage/geometry/polyhedron/backend_number_field.py +168 -0
  48. sage/geometry/polyhedron/backend_polymake.py +765 -0
  49. sage/geometry/polyhedron/backend_ppl.py +582 -0
  50. sage/geometry/polyhedron/base.py +1206 -0
  51. sage/geometry/polyhedron/base0.py +1444 -0
  52. sage/geometry/polyhedron/base1.py +886 -0
  53. sage/geometry/polyhedron/base2.py +812 -0
  54. sage/geometry/polyhedron/base3.py +1845 -0
  55. sage/geometry/polyhedron/base4.py +1262 -0
  56. sage/geometry/polyhedron/base5.py +2700 -0
  57. sage/geometry/polyhedron/base6.py +1741 -0
  58. sage/geometry/polyhedron/base7.py +997 -0
  59. sage/geometry/polyhedron/base_QQ.py +1258 -0
  60. sage/geometry/polyhedron/base_RDF.py +98 -0
  61. sage/geometry/polyhedron/base_ZZ.py +934 -0
  62. sage/geometry/polyhedron/base_mutable.py +215 -0
  63. sage/geometry/polyhedron/base_number_field.py +122 -0
  64. sage/geometry/polyhedron/cdd_file_format.py +155 -0
  65. sage/geometry/polyhedron/combinatorial_polyhedron/all.py +1 -0
  66. sage/geometry/polyhedron/combinatorial_polyhedron/base.cpython-314-x86_64-linux-gnu.so +0 -0
  67. sage/geometry/polyhedron/combinatorial_polyhedron/base.pxd +76 -0
  68. sage/geometry/polyhedron/combinatorial_polyhedron/base.pyx +3859 -0
  69. sage/geometry/polyhedron/combinatorial_polyhedron/combinatorial_face.cpython-314-x86_64-linux-gnu.so +0 -0
  70. sage/geometry/polyhedron/combinatorial_polyhedron/combinatorial_face.pxd +39 -0
  71. sage/geometry/polyhedron/combinatorial_polyhedron/combinatorial_face.pyx +1038 -0
  72. sage/geometry/polyhedron/combinatorial_polyhedron/conversions.cpython-314-x86_64-linux-gnu.so +0 -0
  73. sage/geometry/polyhedron/combinatorial_polyhedron/conversions.pxd +9 -0
  74. sage/geometry/polyhedron/combinatorial_polyhedron/conversions.pyx +501 -0
  75. sage/geometry/polyhedron/combinatorial_polyhedron/face_data_structure.pxd +207 -0
  76. sage/geometry/polyhedron/combinatorial_polyhedron/face_iterator.cpython-314-x86_64-linux-gnu.so +0 -0
  77. sage/geometry/polyhedron/combinatorial_polyhedron/face_iterator.pxd +102 -0
  78. sage/geometry/polyhedron/combinatorial_polyhedron/face_iterator.pyx +2274 -0
  79. sage/geometry/polyhedron/combinatorial_polyhedron/face_list_data_structure.cpython-314-x86_64-linux-gnu.so +0 -0
  80. sage/geometry/polyhedron/combinatorial_polyhedron/face_list_data_structure.pxd +370 -0
  81. sage/geometry/polyhedron/combinatorial_polyhedron/face_list_data_structure.pyx +84 -0
  82. sage/geometry/polyhedron/combinatorial_polyhedron/list_of_faces.cpython-314-x86_64-linux-gnu.so +0 -0
  83. sage/geometry/polyhedron/combinatorial_polyhedron/list_of_faces.pxd +31 -0
  84. sage/geometry/polyhedron/combinatorial_polyhedron/list_of_faces.pyx +587 -0
  85. sage/geometry/polyhedron/combinatorial_polyhedron/polyhedron_face_lattice.cpython-314-x86_64-linux-gnu.so +0 -0
  86. sage/geometry/polyhedron/combinatorial_polyhedron/polyhedron_face_lattice.pxd +52 -0
  87. sage/geometry/polyhedron/combinatorial_polyhedron/polyhedron_face_lattice.pyx +560 -0
  88. sage/geometry/polyhedron/constructor.py +773 -0
  89. sage/geometry/polyhedron/double_description.py +753 -0
  90. sage/geometry/polyhedron/double_description_inhomogeneous.py +564 -0
  91. sage/geometry/polyhedron/face.py +1060 -0
  92. sage/geometry/polyhedron/generating_function.py +1810 -0
  93. sage/geometry/polyhedron/lattice_euclidean_group_element.py +178 -0
  94. sage/geometry/polyhedron/library.py +3502 -0
  95. sage/geometry/polyhedron/misc.py +121 -0
  96. sage/geometry/polyhedron/modules/all.py +1 -0
  97. sage/geometry/polyhedron/modules/formal_polyhedra_module.py +155 -0
  98. sage/geometry/polyhedron/palp_database.py +447 -0
  99. sage/geometry/polyhedron/parent.py +1279 -0
  100. sage/geometry/polyhedron/plot.py +1986 -0
  101. sage/geometry/polyhedron/ppl_lattice_polygon.py +556 -0
  102. sage/geometry/polyhedron/ppl_lattice_polytope.py +1257 -0
  103. sage/geometry/polyhedron/representation.py +1723 -0
  104. sage/geometry/pseudolines.py +515 -0
  105. sage/geometry/relative_interior.py +445 -0
  106. sage/geometry/toric_plotter.py +1103 -0
  107. sage/geometry/triangulation/all.py +2 -0
  108. sage/geometry/triangulation/base.cpython-314-x86_64-linux-gnu.so +0 -0
  109. sage/geometry/triangulation/base.pyx +963 -0
  110. sage/geometry/triangulation/data.h +147 -0
  111. sage/geometry/triangulation/data.pxd +4 -0
  112. sage/geometry/triangulation/element.py +914 -0
  113. sage/geometry/triangulation/functions.h +10 -0
  114. sage/geometry/triangulation/functions.pxd +4 -0
  115. sage/geometry/triangulation/point_configuration.py +2256 -0
  116. sage/geometry/triangulation/triangulations.h +49 -0
  117. sage/geometry/triangulation/triangulations.pxd +7 -0
  118. sage/geometry/voronoi_diagram.py +319 -0
  119. sage/interfaces/all__sagemath_polyhedra.py +1 -0
  120. sage/interfaces/polymake.py +2028 -0
  121. sage/numerical/all.py +13 -0
  122. sage/numerical/all__sagemath_polyhedra.py +11 -0
  123. sage/numerical/backends/all.py +1 -0
  124. sage/numerical/backends/all__sagemath_polyhedra.py +1 -0
  125. sage/numerical/backends/cvxopt_backend.cpython-314-x86_64-linux-gnu.so +0 -0
  126. sage/numerical/backends/cvxopt_backend.pyx +1006 -0
  127. sage/numerical/backends/cvxopt_backend_test.py +19 -0
  128. sage/numerical/backends/cvxopt_sdp_backend.cpython-314-x86_64-linux-gnu.so +0 -0
  129. sage/numerical/backends/cvxopt_sdp_backend.pyx +382 -0
  130. sage/numerical/backends/cvxpy_backend.cpython-314-x86_64-linux-gnu.so +0 -0
  131. sage/numerical/backends/cvxpy_backend.pxd +41 -0
  132. sage/numerical/backends/cvxpy_backend.pyx +934 -0
  133. sage/numerical/backends/cvxpy_backend_test.py +13 -0
  134. sage/numerical/backends/generic_backend_test.py +24 -0
  135. sage/numerical/backends/interactivelp_backend.cpython-314-x86_64-linux-gnu.so +0 -0
  136. sage/numerical/backends/interactivelp_backend.pxd +36 -0
  137. sage/numerical/backends/interactivelp_backend.pyx +1231 -0
  138. sage/numerical/backends/interactivelp_backend_test.py +12 -0
  139. sage/numerical/backends/logging_backend.py +391 -0
  140. sage/numerical/backends/matrix_sdp_backend.cpython-314-x86_64-linux-gnu.so +0 -0
  141. sage/numerical/backends/matrix_sdp_backend.pxd +15 -0
  142. sage/numerical/backends/matrix_sdp_backend.pyx +478 -0
  143. sage/numerical/backends/ppl_backend.cpython-314-x86_64-linux-gnu.so +0 -0
  144. sage/numerical/backends/ppl_backend.pyx +1126 -0
  145. sage/numerical/backends/ppl_backend_test.py +13 -0
  146. sage/numerical/backends/scip_backend.cpython-314-x86_64-linux-gnu.so +0 -0
  147. sage/numerical/backends/scip_backend.pxd +22 -0
  148. sage/numerical/backends/scip_backend.pyx +1289 -0
  149. sage/numerical/backends/scip_backend_test.py +13 -0
  150. sage/numerical/interactive_simplex_method.py +5338 -0
  151. sage/numerical/knapsack.py +665 -0
  152. sage/numerical/linear_functions.cpython-314-x86_64-linux-gnu.so +0 -0
  153. sage/numerical/linear_functions.pxd +31 -0
  154. sage/numerical/linear_functions.pyx +1648 -0
  155. sage/numerical/linear_tensor.py +470 -0
  156. sage/numerical/linear_tensor_constraints.py +448 -0
  157. sage/numerical/linear_tensor_element.cpython-314-x86_64-linux-gnu.so +0 -0
  158. sage/numerical/linear_tensor_element.pxd +6 -0
  159. sage/numerical/linear_tensor_element.pyx +459 -0
  160. sage/numerical/mip.cpython-314-x86_64-linux-gnu.so +0 -0
  161. sage/numerical/mip.pxd +40 -0
  162. sage/numerical/mip.pyx +3667 -0
  163. sage/numerical/sdp.cpython-314-x86_64-linux-gnu.so +0 -0
  164. sage/numerical/sdp.pxd +39 -0
  165. sage/numerical/sdp.pyx +1433 -0
  166. sage/rings/all__sagemath_polyhedra.py +3 -0
  167. sage/rings/polynomial/all__sagemath_polyhedra.py +10 -0
  168. sage/rings/polynomial/omega.py +982 -0
  169. sage/schemes/all__sagemath_polyhedra.py +2 -0
  170. sage/schemes/toric/all.py +10 -0
  171. sage/schemes/toric/chow_group.py +1248 -0
  172. sage/schemes/toric/divisor.py +2082 -0
  173. sage/schemes/toric/divisor_class.cpython-314-x86_64-linux-gnu.so +0 -0
  174. sage/schemes/toric/divisor_class.pyx +322 -0
  175. sage/schemes/toric/fano_variety.py +1606 -0
  176. sage/schemes/toric/homset.py +650 -0
  177. sage/schemes/toric/ideal.py +451 -0
  178. sage/schemes/toric/library.py +1322 -0
  179. sage/schemes/toric/morphism.py +1958 -0
  180. sage/schemes/toric/points.py +1032 -0
  181. sage/schemes/toric/sheaf/all.py +1 -0
  182. sage/schemes/toric/sheaf/constructor.py +302 -0
  183. sage/schemes/toric/sheaf/klyachko.py +921 -0
  184. sage/schemes/toric/toric_subscheme.py +905 -0
  185. sage/schemes/toric/variety.py +3460 -0
  186. sage/schemes/toric/weierstrass.py +1078 -0
  187. sage/schemes/toric/weierstrass_covering.py +457 -0
  188. sage/schemes/toric/weierstrass_higher.py +288 -0
  189. sage_wheels/share/reflexive_polytopes/Full2d/zzdb.info +10 -0
  190. sage_wheels/share/reflexive_polytopes/Full2d/zzdb.v03 +0 -0
  191. sage_wheels/share/reflexive_polytopes/Full2d/zzdb.v04 +0 -0
  192. sage_wheels/share/reflexive_polytopes/Full2d/zzdb.v05 +1 -0
  193. sage_wheels/share/reflexive_polytopes/Full2d/zzdb.v06 +1 -0
  194. sage_wheels/share/reflexive_polytopes/Full3d/zzdb.info +22 -0
  195. sage_wheels/share/reflexive_polytopes/Full3d/zzdb.v04 +0 -0
  196. sage_wheels/share/reflexive_polytopes/Full3d/zzdb.v05 +0 -0
  197. sage_wheels/share/reflexive_polytopes/Full3d/zzdb.v06 +0 -0
  198. sage_wheels/share/reflexive_polytopes/Full3d/zzdb.v07 +0 -0
  199. sage_wheels/share/reflexive_polytopes/Full3d/zzdb.v08 +0 -0
  200. sage_wheels/share/reflexive_polytopes/Full3d/zzdb.v09 +0 -0
  201. sage_wheels/share/reflexive_polytopes/Full3d/zzdb.v10 +0 -0
  202. sage_wheels/share/reflexive_polytopes/Full3d/zzdb.v11 +1 -0
  203. sage_wheels/share/reflexive_polytopes/Full3d/zzdb.v12 +1 -0
  204. sage_wheels/share/reflexive_polytopes/Full3d/zzdb.v13 +1 -0
  205. sage_wheels/share/reflexive_polytopes/reflexive_polytopes_2d +80 -0
  206. sage_wheels/share/reflexive_polytopes/reflexive_polytopes_3d +37977 -0
@@ -0,0 +1,642 @@
1
+ # sage_setup: distribution = sagemath-polyhedra
2
+ r"""
3
+ Ordered Hyperplane Arrangements
4
+
5
+ The :class:`HyperplaneArrangements` orders the hyperplanes in a arrangement
6
+ independently of the way the hyperplanes are introduced. The class
7
+ :class:`OrderedHyperplaneArrangements` fixes an order specified by
8
+ the user. This can be needed for certain properties, e.g., fundamental group with
9
+ information about meridians, braid monodromy with information about the strands;
10
+ in the future, it may be useful for combinatorial properties.
11
+ There are no other differences with usual hyperplane arrangements.
12
+
13
+ An ordered arrangement is an arrangement where the hyperplanes are sorted
14
+ by the user::
15
+
16
+ sage: H0.<t0, t1, t2> = HyperplaneArrangements(QQ)
17
+ sage: H0(t0 - t1, t1 - t2, t0 - t2)
18
+ Arrangement <t1 - t2 | t0 - t1 | t0 - t2>
19
+ sage: H.<t0, t1, t2> = OrderedHyperplaneArrangements(QQ)
20
+ sage: H(t0 - t1, t1 - t2, t0 - t2)
21
+ Arrangement <t0 - t1 | t1 - t2 | t0 - t2>
22
+
23
+ Some methods are adapted, e.g., :meth:`~sage.geometry.hyperplane_arrangement.arrangement.HyperplaneArrangementElement.hyperplanes`,
24
+ and some new ones are created, regarding
25
+ hyperplane sections and fundamental groups::
26
+
27
+ sage: H.<x,y> = HyperplaneArrangements(QQ)
28
+ sage: H1.<x,y> = OrderedHyperplaneArrangements(QQ)
29
+ sage: A1 = H1(x, y); A = H(A1)
30
+ sage: A.hyperplanes()
31
+ (Hyperplane 0*x + y + 0, Hyperplane x + 0*y + 0)
32
+ sage: A1.hyperplanes()
33
+ (Hyperplane x + 0*y + 0, Hyperplane 0*x + y + 0)
34
+
35
+ We see the differences in :meth:`~sage.geometry.hyperplane_arrangement.arrangement.HyperplaneArrangementElement.union`::
36
+
37
+ sage: H.<x,y> = HyperplaneArrangements(QQ)
38
+ sage: H1.<x,y> = OrderedHyperplaneArrangements(QQ)
39
+ sage: A = H([1,2,3], [0,1,1], [0,1,-1], [1,-1,0], [1,1,0])
40
+ sage: B = H([1,1,1], [1,-1,1], [1,0,-1])
41
+ sage: C = A.union(B)
42
+ sage: A1 = H1(A); B1 = H1(B); C1 = A1.union(B1)
43
+ sage: [C1.hyperplanes().index(h) for h in C.hyperplanes()]
44
+ [0, 5, 6, 1, 2, 3, 7, 4]
45
+
46
+ Also in meth:`~sage.geometry.hyperplane_arrangement.arrangement.HyperplaneArrangementElement.cone`::
47
+
48
+ sage: # needs sage.combinat
49
+ sage: a.<x,y,z> = hyperplane_arrangements.semiorder(3)
50
+ sage: H.<x,y,z> = OrderedHyperplaneArrangements(QQ)
51
+ sage: a1 = H(a)
52
+ sage: b = a.cone(); b1 = a1.cone()
53
+ sage: [b1.hyperplanes().index(h) for h in b.hyperplanes()]
54
+ [0, 2, 4, 6, 1, 3, 5]
55
+
56
+ And in :meth:`~sage.geometry.hyperplane_arrangement.arrangement.HyperplaneArrangementElement.restriction`::
57
+
58
+ sage: # needs sage.graphs
59
+ sage: A.<u, x, y, z> = hyperplane_arrangements.braid(4)
60
+ sage: L.<u, x, y, z> = OrderedHyperplaneArrangements(QQ)
61
+ sage: A1 = L(A)
62
+ sage: H = A[0]; H
63
+ Hyperplane 0*u + 0*x + y - z + 0
64
+ sage: A.restriction(H)
65
+ Arrangement <x - z | u - x | u - z>
66
+ sage: A1.restriction(H)
67
+ Arrangement <x - z | u - x | u - z>
68
+ sage: A1.restriction(H, repetitions=True)
69
+ Arrangement of 5 hyperplanes of dimension 3 and rank 2
70
+
71
+ AUTHORS:
72
+
73
+ - Enrique Artal (2023-12): initial version
74
+
75
+ This module adds some features to the *unordered* one for some
76
+ properties which depend on the order.
77
+ """
78
+
79
+ # *****************************************************************************
80
+ # Copyright (C) 2023 Enrique Artal <artal@unizar.es>
81
+ #
82
+ # This program is free software: you can redistribute it and/or modify
83
+ # it under the terms of the GNU General Public License as published by
84
+ # the Free Software Foundation, either version 2 of the License, or
85
+ # (at your option) any later version.
86
+ # http://www.gnu.org/licenses/
87
+ # *****************************************************************************
88
+
89
+ from sage.geometry.hyperplane_arrangement.arrangement import HyperplaneArrangementElement
90
+ from sage.geometry.hyperplane_arrangement.arrangement import HyperplaneArrangements
91
+ from sage.geometry.hyperplane_arrangement.hyperplane import Hyperplane
92
+ from sage.matrix.constructor import matrix, vector
93
+ from sage.misc.lazy_import import lazy_import
94
+ from sage.misc.misc_c import prod
95
+ from sage.rings.integer_ring import ZZ
96
+
97
+ lazy_import('sage.groups.free_group', 'FreeGroup')
98
+ lazy_import('sage.rings.qqbar', 'QQbar')
99
+ lazy_import('sage.schemes.curves.plane_curve_arrangement', 'AffinePlaneCurveArrangements')
100
+ lazy_import('sage.schemes.curves.plane_curve_arrangement', 'ProjectivePlaneCurveArrangements')
101
+
102
+
103
+ class OrderedHyperplaneArrangementElement(HyperplaneArrangementElement):
104
+ """
105
+ An ordered hyperplane arrangement.
106
+
107
+ .. WARNING::
108
+
109
+ You should never create
110
+ :class:`OrderedHyperplaneArrangementElement` instances directly,
111
+ always use the parent.
112
+ """
113
+ def __init__(self, parent, hyperplanes, check=True, backend=None):
114
+ """
115
+ Construct an ordered hyperplane arrangement.
116
+
117
+ INPUT:
118
+
119
+ - ``parent`` -- the parent :class:`OrderedHyperplaneArrangements`
120
+
121
+ - ``hyperplanes`` -- tuple of hyperplanes
122
+
123
+ - ``check`` -- boolean (default: ``True``); whether
124
+ to check input
125
+
126
+ - ``backend`` -- string (default: ``None``); the backend to
127
+ use for the related polyhedral objects
128
+
129
+ EXAMPLES::
130
+
131
+ sage: H.<x,y> = OrderedHyperplaneArrangements(QQ)
132
+ sage: elt = H(x, y); elt
133
+ Arrangement <x | y>
134
+ sage: TestSuite(elt).run()
135
+ """
136
+ super().__init__(parent, hyperplanes, check=check, backend=backend)
137
+ self._affine_fundamental_group = None
138
+ self._affine_meridians = None
139
+ self._projective_fundamental_group = None
140
+ self._projective_meridians = None
141
+
142
+ def hyperplane_section(self, proj=True):
143
+ r"""
144
+ Compute a generic hyperplane section of ``self``.
145
+
146
+ INPUT:
147
+
148
+ - ``proj`` -- (default: ``True``) if the
149
+ ambient space is affine or projective
150
+
151
+ OUTPUT:
152
+
153
+ An arrangement `\mathcal{A}` obtained by intersecting with a
154
+ generic hyperplane
155
+
156
+ EXAMPLES::
157
+
158
+ sage: L.<x, y, z> = OrderedHyperplaneArrangements(QQ)
159
+ sage: L(x, y - 1, z).hyperplane_section()
160
+ Traceback (most recent call last):
161
+ ...
162
+ TypeError: the arrangement is not projective
163
+
164
+ sage: # needs sage.graphs
165
+ sage: A0.<u,x,y,z> = hyperplane_arrangements.braid(4); A0
166
+ Arrangement of 6 hyperplanes of dimension 4 and rank 3
167
+ sage: L.<u,x,y,z> = OrderedHyperplaneArrangements(QQ)
168
+ sage: A = L(A0)
169
+ sage: M = A.matroid()
170
+ sage: A1 = A.hyperplane_section()
171
+ sage: A1
172
+ Arrangement of 6 hyperplanes of dimension 3 and rank 3
173
+ sage: M1 = A1.matroid()
174
+ sage: A2 = A1.hyperplane_section(); A2
175
+ Arrangement of 6 hyperplanes of dimension 2 and rank 2
176
+ sage: M2 = A2.matroid()
177
+ sage: T1 = M1.truncation()
178
+ sage: T1.is_isomorphic(M2)
179
+ True
180
+ sage: T1.isomorphism(M2)
181
+ {0: 0, 1: 1, 2: 2, 3: 3, 4: 4, 5: 5}
182
+
183
+ sage: # needs sage.combinat
184
+ sage: a0 = hyperplane_arrangements.semiorder(3); a0
185
+ Arrangement of 6 hyperplanes of dimension 3 and rank 2
186
+ sage: L.<t0, t1, t2> = OrderedHyperplaneArrangements(QQ)
187
+ sage: a = L(a0)
188
+ sage: ca = a.cone()
189
+ sage: m = ca.matroid()
190
+ sage: a1 = a.hyperplane_section(proj=False)
191
+ sage: a1
192
+ Arrangement of 6 hyperplanes of dimension 2 and rank 2
193
+ sage: ca1 = a1.cone()
194
+ sage: m1 = ca1.matroid()
195
+ sage: m.isomorphism(m1)
196
+ {0: 0, 1: 1, 2: 2, 3: 3, 4: 4, 5: 5, 6: 6}
197
+ sage: p0 = hyperplane_arrangements.Shi(4)
198
+ sage: L.<t0, t1, t2, t3> = OrderedHyperplaneArrangements(QQ)
199
+ sage: p = L(p0)
200
+ sage: a = p.hyperplane_section(proj=False); a
201
+ Arrangement of 12 hyperplanes of dimension 3 and rank 3
202
+ sage: ca = a.cone()
203
+ sage: m = ca.matroid().truncation()
204
+ sage: a1 = a.hyperplane_section(proj=False); a1
205
+ Arrangement of 12 hyperplanes of dimension 2 and rank 2
206
+ sage: ca1 = a1.cone()
207
+ sage: m1 = ca1.matroid()
208
+ sage: m1.is_isomorphism(m, {j: j for j in range(13)})
209
+ True
210
+ """
211
+ if proj and not self.is_linear():
212
+ raise TypeError('the arrangement is not projective')
213
+ n0 = self.dimension()
214
+ if not proj:
215
+ H = self.cone()
216
+ H1 = H.hyperplane_section()
217
+ mat = matrix(h.coefficients()[1:] for h in H1)
218
+ m = mat.nrows()
219
+ for j in range(mat.ncols()):
220
+ if mat[m - 1, j] != 0:
221
+ mat.swap_columns(0, j)
222
+ break
223
+ for j in range(1, mat.ncols()):
224
+ mat.add_multiple_of_column(j, 0, -mat[m - 1, j] / mat[m - 1, 0])
225
+ vrs = H1.parent().variable_names()[1:]
226
+ A1 = OrderedHyperplaneArrangements(self.base_ring(), names=vrs)
227
+ mat_rows = mat.rows()[:-1]
228
+ H1b = A1(mat_rows)
229
+ return H1b
230
+ P = self.intersection_poset(element_label='subspace')
231
+ center = P.maximal_elements()[0].linear_part()
232
+ n1 = center.dimension()
233
+ U = []
234
+ for p in P:
235
+ if p.dimension() == n1 + 1:
236
+ B = [u for u in p.linear_part().basis() if u not in center]
237
+ U.append(B[0])
238
+ # U = [p.linear_part().basis()[0] for p in P if p.dimension() == n1 + 1]
239
+ U0 = sum(U)
240
+ # We look for a linear hyperplane with integer coefficients
241
+ # defining a transversal hyperplane
242
+ for v in ZZ**n0:
243
+ v1 = v + U0
244
+ if 0 not in [w * v1 for w in U]:
245
+ break
246
+ h0 = self.parent()((0,) + tuple(v1))
247
+ H1 = self.add_hyperplane(h0)
248
+ return H1.restriction(h0)
249
+
250
+ def affine_fundamental_group(self):
251
+ r"""
252
+ Return the fundamental group of the complement of an affine
253
+ hyperplane arrangement in `\CC^n` whose equations have
254
+ coefficients in a subfield of `\QQbar`.
255
+
256
+ OUTPUT: a finitely presented fundamental group
257
+
258
+ .. NOTE::
259
+
260
+ This functionality requires the ``sirocco`` package to be installed.
261
+
262
+ EXAMPLES::
263
+
264
+ sage: # needs sirocco
265
+ sage: A.<x, y> = OrderedHyperplaneArrangements(QQ)
266
+ sage: L = [y + x, y + x - 1]
267
+ sage: H = A(L)
268
+ sage: H.affine_fundamental_group()
269
+ Finitely presented group < x0, x1 | >
270
+ sage: L = [x, y, x + 1, y + 1, x - y]
271
+ sage: A(L).affine_fundamental_group()
272
+ Finitely presented group
273
+ < x0, x1, x2, x3, x4 | x4*x0*x4^-1*x0^-1,
274
+ x0*x2*x3*x2^-1*x0^-1*x3^-1,
275
+ x1*x2*x4*x2^-1*x1^-1*x4^-1,
276
+ x2*x3*x0*x2^-1*x0^-1*x3^-1,
277
+ x2*x4*x1*x2^-1*x1^-1*x4^-1,
278
+ x4*x1*x4^-1*x3^-1*x2^-1*x1^-1*x2*x3 >
279
+ sage: H = A(x, y, x + y)
280
+ sage: H.affine_fundamental_group()
281
+ Finitely presented group
282
+ < x0, x1, x2 | x0*x1*x2*x1^-1*x0^-1*x2^-1, x1*x2*x0*x1^-1*x0^-1*x2^-1 >
283
+ sage: H.affine_fundamental_group() # repeat to use the attribute
284
+ Finitely presented group
285
+ < x0, x1, x2 | x0*x1*x2*x1^-1*x0^-1*x2^-1, x1*x2*x0*x1^-1*x0^-1*x2^-1 >
286
+ sage: T.<t> = QQ[]
287
+ sage: K.<a> = NumberField(t^3 + t + 1)
288
+ sage: L.<x, y> = OrderedHyperplaneArrangements(K)
289
+ sage: H = L(a*x + y -1, x + a*y + 1, x - 1, y - 1)
290
+ sage: H.affine_fundamental_group()
291
+ Traceback (most recent call last):
292
+ ...
293
+ TypeError: the base field is not in QQbar
294
+ sage: L.<t> = OrderedHyperplaneArrangements(QQ)
295
+ sage: L([t - j for j in range(4)]).affine_fundamental_group()
296
+ Finitely presented group < x0, x1, x2, x3 | >
297
+ sage: L.<x, y, z> = OrderedHyperplaneArrangements(QQ)
298
+ sage: L(L.gens() + (x + y + z + 1,)).affine_fundamental_group().sorted_presentation()
299
+ Finitely presented group
300
+ < x0, x1, x2, x3 | x3^-1*x2^-1*x3*x2, x3^-1*x1^-1*x3*x1,
301
+ x3^-1*x0^-1*x3*x0, x2^-1*x1^-1*x2*x1,
302
+ x2^-1*x0^-1*x2*x0, x1^-1*x0^-1*x1*x0 >
303
+ sage: A = OrderedHyperplaneArrangements(QQ, names=())
304
+ sage: H = A(); H
305
+ Empty hyperplane arrangement of dimension 0
306
+ sage: H.affine_fundamental_group()
307
+ Finitely presented group < | >
308
+ """
309
+ K = self.base_ring()
310
+ if not K.is_subring(QQbar):
311
+ raise TypeError('the base field is not in QQbar')
312
+ if self._affine_fundamental_group:
313
+ return self._affine_fundamental_group
314
+ n = self.dimension()
315
+ r = len(self)
316
+ if n == 0:
317
+ return FreeGroup(0) / []
318
+ if n == 1:
319
+ G = FreeGroup(r) / []
320
+ dic = {j: G.gen(j) for j in range(r)}
321
+ dic[r] = [prod(G.gens()) ** -1]
322
+ self._affine_fundamental_group = G
323
+ self._affine_meridians = dic
324
+ return G
325
+ if n == 2:
326
+ S = self.parent().ambient_space().symmetric_space()
327
+ coord = vector((1,) + S.gens())
328
+ Af = AffinePlaneCurveArrangements(K, names=self.parent().variable_names())
329
+ L = Af([vector(line.coefficients()) * coord for line in self])
330
+ G = L.fundamental_group()
331
+ self._affine_fundamental_group = G
332
+ self._affine_meridians = L._meridians_simpl_vertical
333
+ return G
334
+ H1 = self.hyperplane_section(proj=False)
335
+ G = H1.affine_fundamental_group()
336
+ self._affine_fundamental_group = G
337
+ self._affine_meridians = H1._affine_meridians
338
+ return G
339
+
340
+ def affine_meridians(self):
341
+ r"""
342
+ Return the meridians of each hyperplane (including the one at infinity).
343
+
344
+ OUTPUT: a dictionary
345
+
346
+ .. NOTE::
347
+
348
+ This functionality requires the ``sirocco`` package to be installed.
349
+
350
+ EXAMPLES::
351
+
352
+ sage: # needs sirocco
353
+ sage: A.<x, y> = OrderedHyperplaneArrangements(QQ)
354
+ sage: L = [y + x, y + x - 1]
355
+ sage: H = A(L)
356
+ sage: g = H.affine_fundamental_group()
357
+ sage: g
358
+ Finitely presented group < x0, x1 | >
359
+ sage: H.affine_meridians()
360
+ {0: [x0], 1: [x1], 2: [x1^-1*x0^-1]}
361
+ sage: H1 = H.add_hyperplane(y - x)
362
+ sage: H1.affine_meridians()
363
+ {0: [x0], 1: [x1], 2: [x2], 3: [x2^-1*x1^-1*x0^-1]}
364
+ """
365
+ if self._affine_meridians is None:
366
+ self.affine_fundamental_group()
367
+ return dict(self._affine_meridians)
368
+
369
+ def projective_fundamental_group(self):
370
+ r"""
371
+ Return the fundamental group of the complement of a projective
372
+ hyperplane arrangement.
373
+
374
+ OUTPUT:
375
+
376
+ The finitely presented group of the complement
377
+ in the projective space whose equations have
378
+ coefficients in a subfield of `\QQbar`.
379
+
380
+ .. NOTE::
381
+
382
+ This functionality requires the ``sirocco`` package to be installed.
383
+
384
+ EXAMPLES::
385
+
386
+ sage: # needs sirocco
387
+ sage: A.<x, y> = OrderedHyperplaneArrangements(QQ)
388
+ sage: H = A(x, y, x + y)
389
+ sage: H.projective_fundamental_group()
390
+ Finitely presented group < x0, x1 | >
391
+
392
+ sage: # optional - sirocco, needs sage.graphs
393
+ sage: A3.<x, y, z> = OrderedHyperplaneArrangements(QQ)
394
+ sage: H = A3(hyperplane_arrangements.braid(4).essentialization())
395
+ sage: G3 = H.projective_fundamental_group(); G3.sorted_presentation()
396
+ Finitely presented group
397
+ < x0, x1, x2, x3, x4 | x4^-1*x3^-1*x2^-1*x3*x4*x0*x2*x0^-1,
398
+ x4^-1*x2^-1*x4*x2, x4^-1*x1^-1*x0^-1*x1*x4*x0,
399
+ x4^-1*x1^-1*x0^-1*x4*x0*x1,
400
+ x3^-1*x2^-1*x1^-1*x0^-1*x3*x0*x1*x2,
401
+ x3^-1*x1^-1*x3*x1 >
402
+ sage: G3.abelian_invariants()
403
+ (0, 0, 0, 0, 0)
404
+ sage: A4.<t1, t2, t3, t4> = OrderedHyperplaneArrangements(QQ)
405
+ sage: H = A4(hyperplane_arrangements.braid(4))
406
+ sage: G4 = H.projective_fundamental_group(); G4.sorted_presentation()
407
+ Finitely presented group
408
+ < x0, x1, x2, x3, x4 | x4^-1*x3^-1*x2^-1*x3*x4*x0*x2*x0^-1,
409
+ x4^-1*x2^-1*x4*x2, x4^-1*x1^-1*x0^-1*x1*x4*x0,
410
+ x4^-1*x1^-1*x0^-1*x4*x0*x1,
411
+ x3^-1*x2^-1*x1^-1*x0^-1*x3*x0*x1*x2, x3^-1*x1^-1*x3*x1 >
412
+ sage: G4.abelian_invariants()
413
+ (0, 0, 0, 0, 0)
414
+
415
+ sage: # needs sirocco
416
+ sage: L.<t0, t1, t2, t3, t4> = OrderedHyperplaneArrangements(QQ)
417
+ sage: H = hyperplane_arrangements.coordinate(5)
418
+ sage: H = L(H)
419
+ sage: g = H.projective_fundamental_group()
420
+ sage: g.is_abelian(), g.abelian_invariants()
421
+ (True, (0, 0, 0, 0))
422
+ sage: L(t0, t1, t2, t3, t4, t0 - 1).projective_fundamental_group()
423
+ Traceback (most recent call last):
424
+ ...
425
+ TypeError: the arrangement is not projective
426
+ sage: T.<t> = QQ[]
427
+ sage: K.<a> = NumberField(t^3 + t + 1)
428
+ sage: L.<x, y, z> = OrderedHyperplaneArrangements(K)
429
+ sage: H = L(a*x + y - z, x + a*y + z, x - z, y - z)
430
+ sage: H.projective_fundamental_group()
431
+ Traceback (most recent call last):
432
+ ...
433
+ TypeError: the base field is not in QQbar
434
+ sage: A.<x> = OrderedHyperplaneArrangements(QQ)
435
+ sage: H = A(); H
436
+ Empty hyperplane arrangement of dimension 1
437
+ sage: H.projective_fundamental_group()
438
+ Finitely presented group < | >
439
+ """
440
+ K = self.base_ring()
441
+ if not K.is_subring(QQbar):
442
+ raise TypeError('the base field is not in QQbar')
443
+ if not self.is_linear():
444
+ raise TypeError('the arrangement is not projective')
445
+ if self._projective_fundamental_group:
446
+ return self._projective_fundamental_group
447
+ n = self.dimension()
448
+ r = len(self)
449
+ if n == 1:
450
+ return FreeGroup(0) / []
451
+ if n == 2:
452
+ G = FreeGroup(r - 1) / []
453
+ dic = {j: G.gen(j) for j in range(r - 1)}
454
+ dic[r - 1] = [prod(G.gens()) ** -1]
455
+ self._projective_fundamental_group = G
456
+ self._projective_meridians = dic
457
+ return G
458
+ if n == 3:
459
+ S = self.parent().ambient_space().symmetric_space()
460
+ coord = vector(S.gens())
461
+ Proj = ProjectivePlaneCurveArrangements(K,
462
+ names=self.parent().variable_names())
463
+ L = Proj([vector(line.coefficients()[1:]) * coord for line in self])
464
+ G = L.fundamental_group()
465
+ self._projective_fundamental_group = G
466
+ self._projective_meridians = L._meridians_simpl
467
+ return G
468
+ H1 = self.hyperplane_section()
469
+ G = H1.projective_fundamental_group()
470
+ self._projective_fundamental_group = G
471
+ self._projective_meridians = H1._projective_meridians
472
+ return G
473
+
474
+ def projective_meridians(self):
475
+ r"""
476
+ Return the meridian of each hyperplane.
477
+
478
+ OUTPUT: a dictionary
479
+
480
+ .. NOTE::
481
+
482
+ This functionality requires the ``sirocco`` package to be installed.
483
+
484
+ EXAMPLES::
485
+
486
+ sage: # needs sirocco
487
+ sage: A.<x, y> = OrderedHyperplaneArrangements(QQ)
488
+ sage: H = A(x, y, x + y)
489
+ sage: H.projective_meridians()
490
+ {0: x0, 1: x1, 2: [x1^-1*x0^-1]}
491
+
492
+ sage: # optional - sirocco, needs sage.graphs
493
+ sage: A3.<x, y, z> = OrderedHyperplaneArrangements(QQ)
494
+ sage: H = A3(hyperplane_arrangements.braid(4).essentialization())
495
+ sage: H.projective_meridians()
496
+ {0: [x2^-1*x0^-1*x4^-1*x3^-1*x1^-1],
497
+ 1: [x3], 2: [x4], 3: [x1], 4: [x2], 5: [x0]}
498
+ sage: A4.<t1, t2, t3, t4> = OrderedHyperplaneArrangements(QQ)
499
+ sage: H = A4(hyperplane_arrangements.braid(4))
500
+ sage: H.projective_meridians()
501
+ {0: [x2^-1*x0^-1*x4^-1*x3^-1*x1^-1], 1: [x3],
502
+ 2: [x4], 3: [x0], 4: [x2], 5: [x1]}
503
+
504
+ sage: # needs sirocco
505
+ sage: L.<t0, t1, t2, t3, t4> = OrderedHyperplaneArrangements(QQ)
506
+ sage: H = hyperplane_arrangements.coordinate(5)
507
+ sage: H = L(H)
508
+ sage: H.projective_meridians()
509
+ {0: [x2], 1: [x3], 2: [x0], 3: [x3^-1*x2^-1*x1^-1*x0^-1], 4: [x1]}
510
+ """
511
+ if self._projective_meridians is None:
512
+ self.projective_fundamental_group()
513
+ return dict(self._projective_meridians)
514
+
515
+
516
+ class OrderedHyperplaneArrangements(HyperplaneArrangements):
517
+ """
518
+ Ordered Hyperplane arrangements.
519
+
520
+ For more information on hyperplane arrangements, see
521
+ :mod:`sage.geometry.hyperplane_arrangement.arrangement`.
522
+
523
+ INPUT:
524
+
525
+ - ``base_ring`` -- ring; the base ring
526
+
527
+ - ``names`` -- tuple of strings; the variable names
528
+
529
+ EXAMPLES::
530
+
531
+ sage: H.<x,y> = HyperplaneArrangements(QQ)
532
+ sage: x
533
+ Hyperplane x + 0*y + 0
534
+ sage: x + y
535
+ Hyperplane x + y + 0
536
+ sage: H(x, y, x-1, y-1)
537
+ Arrangement <y - 1 | y | x - 1 | x>
538
+ """
539
+ Element = OrderedHyperplaneArrangementElement
540
+
541
+ def _element_constructor_(self, *args, **kwds):
542
+ """
543
+ Construct an element of ``self``.
544
+
545
+ INPUT:
546
+
547
+ - ``*args`` -- positional arguments, each defining a
548
+ hyperplane; alternatively, a single polytope or a single
549
+ hyperplane arrangement
550
+
551
+ - ``signed`` -- boolean (default: ``True``); whether to
552
+ preserve signs of hyperplane equations
553
+
554
+ - ``check`` -- boolean (default: ``True``); whether to
555
+ perform argument checking
556
+
557
+ EXAMPLES::
558
+
559
+ sage: L.<x, y> = OrderedHyperplaneArrangements(QQ)
560
+ sage: L(x)
561
+ Arrangement <x>
562
+ sage: L(x, y)
563
+ Arrangement <x | y>
564
+ sage: L([x, y])
565
+ Arrangement <x | y>
566
+ sage: L([0, 1, 0], [0, 0, 1])
567
+ Arrangement <x | y>
568
+ sage: L([[0, 0, 1], [0, 1, 0]])
569
+ Arrangement <y | x>
570
+
571
+ sage: L(polytopes.hypercube(2))
572
+ Arrangement <-x + 1 | -y + 1 | x + 1 | y + 1>
573
+
574
+ sage: L(-x, x + y - 1, signed=False)
575
+ Arrangement <x | -x - y + 1>
576
+
577
+ TESTS::
578
+
579
+ sage: L()
580
+ Empty hyperplane arrangement of dimension 2
581
+ sage: L(0) # zero is equivalent to no argument, Issue #8648
582
+ Empty hyperplane arrangement of dimension 2
583
+ sage: L(0*x) # degenerate hyperplane is NOT allowed
584
+ Traceback (most recent call last):
585
+ ...
586
+ ValueError: linear expression must be non-constant to define a hyperplane
587
+ sage: L(0*x, y) # ditto
588
+ Traceback (most recent call last):
589
+ ...
590
+ ValueError: linear expression must be non-constant to define a hyperplane
591
+ """
592
+ if len(args) == 1:
593
+ arg = args[0]
594
+ if isinstance(arg, HyperplaneArrangementElement) and arg.parent() is self:
595
+ # optimization if argument is already a hyperplane arrangement
596
+ return arg
597
+ if arg == 0 and not isinstance(arg, Hyperplane):
598
+ # zero = neutral element under addition = the empty hyperplane arrangement
599
+ args = []
600
+ # process keyword arguments
601
+ not_char2 = (self.base_ring().characteristic() != 2)
602
+ signed = kwds.pop('signed', not_char2)
603
+ check = kwds.pop('check', True)
604
+ backend = kwds.pop('backend', None)
605
+ if kwds:
606
+ raise ValueError('unknown keyword argument')
607
+ # process positional arguments
608
+ AA = self.ambient_space()
609
+ try:
610
+ hyperplanes = [AA(a) for a in args]
611
+ except (TypeError, ValueError, AttributeError):
612
+ if len(args) > 1:
613
+ raise
614
+ arg = args[0]
615
+ if hasattr(arg, 'Hrepresentation'):
616
+ hyperplanes = [AA(h) for h in arg.Hrepresentation()]
617
+ else:
618
+ hyperplanes = [AA(a) for a in arg]
619
+ hyperplanes = [h.primitive(signed) for h in hyperplanes]
620
+ if check:
621
+ if signed and not not_char2:
622
+ raise ValueError('cannot be signed in characteristic 2')
623
+ for h in hyperplanes:
624
+ if h.A() == 0:
625
+ raise ValueError('linear expression must be non-constant to define a hyperplane')
626
+ if not_char2 and -h in hyperplanes:
627
+ raise ValueError('arrangement cannot simultaneously have h and -h as hyperplane')
628
+ return self.element_class(self, tuple(hyperplanes), backend=backend)
629
+
630
+ def _repr_(self):
631
+ """
632
+ Return a string representation.
633
+
634
+ OUTPUT: string
635
+
636
+ EXAMPLES::
637
+
638
+ sage: L.<x, y> = OrderedHyperplaneArrangements(QQ); L
639
+ Ordered hyperplane arrangements in 2-dimensional linear space
640
+ over Rational Field with coordinates x, y
641
+ """
642
+ return 'Ordered hyperplane arrangements in {0}'.format(self.ambient_space())