passagemath-polyhedra 10.6.37__cp314-cp314-musllinux_1_2_x86_64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (209) hide show
  1. passagemath_polyhedra/__init__.py +3 -0
  2. passagemath_polyhedra-10.6.37.dist-info/METADATA +367 -0
  3. passagemath_polyhedra-10.6.37.dist-info/METADATA.bak +369 -0
  4. passagemath_polyhedra-10.6.37.dist-info/RECORD +209 -0
  5. passagemath_polyhedra-10.6.37.dist-info/WHEEL +5 -0
  6. passagemath_polyhedra-10.6.37.dist-info/top_level.txt +3 -0
  7. passagemath_polyhedra.libs/libgcc_s-0cd532bd.so.1 +0 -0
  8. passagemath_polyhedra.libs/libgmp-0e7fc84e.so.10.5.0 +0 -0
  9. passagemath_polyhedra.libs/libgomp-8949ffbe.so.1.0.0 +0 -0
  10. passagemath_polyhedra.libs/libstdc++-5d72f927.so.6.0.33 +0 -0
  11. sage/all__sagemath_polyhedra.py +50 -0
  12. sage/game_theory/all.py +8 -0
  13. sage/game_theory/catalog.py +6 -0
  14. sage/game_theory/catalog_normal_form_games.py +923 -0
  15. sage/game_theory/cooperative_game.py +844 -0
  16. sage/game_theory/matching_game.py +1181 -0
  17. sage/game_theory/normal_form_game.py +2697 -0
  18. sage/game_theory/parser.py +275 -0
  19. sage/geometry/all__sagemath_polyhedra.py +22 -0
  20. sage/geometry/cone.py +6940 -0
  21. sage/geometry/cone_catalog.py +847 -0
  22. sage/geometry/cone_critical_angles.py +1027 -0
  23. sage/geometry/convex_set.py +1119 -0
  24. sage/geometry/fan.py +3743 -0
  25. sage/geometry/fan_isomorphism.py +389 -0
  26. sage/geometry/fan_morphism.py +1884 -0
  27. sage/geometry/hasse_diagram.py +202 -0
  28. sage/geometry/hyperplane_arrangement/affine_subspace.py +390 -0
  29. sage/geometry/hyperplane_arrangement/all.py +1 -0
  30. sage/geometry/hyperplane_arrangement/arrangement.py +3905 -0
  31. sage/geometry/hyperplane_arrangement/check_freeness.py +145 -0
  32. sage/geometry/hyperplane_arrangement/hyperplane.py +773 -0
  33. sage/geometry/hyperplane_arrangement/library.py +825 -0
  34. sage/geometry/hyperplane_arrangement/ordered_arrangement.py +642 -0
  35. sage/geometry/hyperplane_arrangement/plot.py +520 -0
  36. sage/geometry/integral_points.py +35 -0
  37. sage/geometry/integral_points_generic_dense.cpython-314-x86_64-linux-musl.so +0 -0
  38. sage/geometry/integral_points_generic_dense.pyx +7 -0
  39. sage/geometry/lattice_polytope.py +5894 -0
  40. sage/geometry/linear_expression.py +773 -0
  41. sage/geometry/newton_polygon.py +767 -0
  42. sage/geometry/point_collection.cpython-314-x86_64-linux-musl.so +0 -0
  43. sage/geometry/point_collection.pyx +1008 -0
  44. sage/geometry/polyhedral_complex.py +2616 -0
  45. sage/geometry/polyhedron/all.py +8 -0
  46. sage/geometry/polyhedron/backend_cdd.py +460 -0
  47. sage/geometry/polyhedron/backend_cdd_rdf.py +231 -0
  48. sage/geometry/polyhedron/backend_field.py +347 -0
  49. sage/geometry/polyhedron/backend_normaliz.py +2503 -0
  50. sage/geometry/polyhedron/backend_number_field.py +168 -0
  51. sage/geometry/polyhedron/backend_polymake.py +765 -0
  52. sage/geometry/polyhedron/backend_ppl.py +582 -0
  53. sage/geometry/polyhedron/base.py +1206 -0
  54. sage/geometry/polyhedron/base0.py +1444 -0
  55. sage/geometry/polyhedron/base1.py +886 -0
  56. sage/geometry/polyhedron/base2.py +812 -0
  57. sage/geometry/polyhedron/base3.py +1845 -0
  58. sage/geometry/polyhedron/base4.py +1262 -0
  59. sage/geometry/polyhedron/base5.py +2700 -0
  60. sage/geometry/polyhedron/base6.py +1741 -0
  61. sage/geometry/polyhedron/base7.py +997 -0
  62. sage/geometry/polyhedron/base_QQ.py +1258 -0
  63. sage/geometry/polyhedron/base_RDF.py +98 -0
  64. sage/geometry/polyhedron/base_ZZ.py +934 -0
  65. sage/geometry/polyhedron/base_mutable.py +215 -0
  66. sage/geometry/polyhedron/base_number_field.py +122 -0
  67. sage/geometry/polyhedron/cdd_file_format.py +155 -0
  68. sage/geometry/polyhedron/combinatorial_polyhedron/all.py +1 -0
  69. sage/geometry/polyhedron/combinatorial_polyhedron/base.cpython-314-x86_64-linux-musl.so +0 -0
  70. sage/geometry/polyhedron/combinatorial_polyhedron/base.pxd +76 -0
  71. sage/geometry/polyhedron/combinatorial_polyhedron/base.pyx +3859 -0
  72. sage/geometry/polyhedron/combinatorial_polyhedron/combinatorial_face.cpython-314-x86_64-linux-musl.so +0 -0
  73. sage/geometry/polyhedron/combinatorial_polyhedron/combinatorial_face.pxd +39 -0
  74. sage/geometry/polyhedron/combinatorial_polyhedron/combinatorial_face.pyx +1038 -0
  75. sage/geometry/polyhedron/combinatorial_polyhedron/conversions.cpython-314-x86_64-linux-musl.so +0 -0
  76. sage/geometry/polyhedron/combinatorial_polyhedron/conversions.pxd +9 -0
  77. sage/geometry/polyhedron/combinatorial_polyhedron/conversions.pyx +501 -0
  78. sage/geometry/polyhedron/combinatorial_polyhedron/face_data_structure.pxd +207 -0
  79. sage/geometry/polyhedron/combinatorial_polyhedron/face_iterator.cpython-314-x86_64-linux-musl.so +0 -0
  80. sage/geometry/polyhedron/combinatorial_polyhedron/face_iterator.pxd +102 -0
  81. sage/geometry/polyhedron/combinatorial_polyhedron/face_iterator.pyx +2274 -0
  82. sage/geometry/polyhedron/combinatorial_polyhedron/face_list_data_structure.cpython-314-x86_64-linux-musl.so +0 -0
  83. sage/geometry/polyhedron/combinatorial_polyhedron/face_list_data_structure.pxd +370 -0
  84. sage/geometry/polyhedron/combinatorial_polyhedron/face_list_data_structure.pyx +84 -0
  85. sage/geometry/polyhedron/combinatorial_polyhedron/list_of_faces.cpython-314-x86_64-linux-musl.so +0 -0
  86. sage/geometry/polyhedron/combinatorial_polyhedron/list_of_faces.pxd +31 -0
  87. sage/geometry/polyhedron/combinatorial_polyhedron/list_of_faces.pyx +587 -0
  88. sage/geometry/polyhedron/combinatorial_polyhedron/polyhedron_face_lattice.cpython-314-x86_64-linux-musl.so +0 -0
  89. sage/geometry/polyhedron/combinatorial_polyhedron/polyhedron_face_lattice.pxd +52 -0
  90. sage/geometry/polyhedron/combinatorial_polyhedron/polyhedron_face_lattice.pyx +560 -0
  91. sage/geometry/polyhedron/constructor.py +773 -0
  92. sage/geometry/polyhedron/double_description.py +753 -0
  93. sage/geometry/polyhedron/double_description_inhomogeneous.py +564 -0
  94. sage/geometry/polyhedron/face.py +1060 -0
  95. sage/geometry/polyhedron/generating_function.py +1810 -0
  96. sage/geometry/polyhedron/lattice_euclidean_group_element.py +178 -0
  97. sage/geometry/polyhedron/library.py +3502 -0
  98. sage/geometry/polyhedron/misc.py +121 -0
  99. sage/geometry/polyhedron/modules/all.py +1 -0
  100. sage/geometry/polyhedron/modules/formal_polyhedra_module.py +155 -0
  101. sage/geometry/polyhedron/palp_database.py +447 -0
  102. sage/geometry/polyhedron/parent.py +1279 -0
  103. sage/geometry/polyhedron/plot.py +1986 -0
  104. sage/geometry/polyhedron/ppl_lattice_polygon.py +556 -0
  105. sage/geometry/polyhedron/ppl_lattice_polytope.py +1257 -0
  106. sage/geometry/polyhedron/representation.py +1723 -0
  107. sage/geometry/pseudolines.py +515 -0
  108. sage/geometry/relative_interior.py +445 -0
  109. sage/geometry/toric_plotter.py +1103 -0
  110. sage/geometry/triangulation/all.py +2 -0
  111. sage/geometry/triangulation/base.cpython-314-x86_64-linux-musl.so +0 -0
  112. sage/geometry/triangulation/base.pyx +963 -0
  113. sage/geometry/triangulation/data.h +147 -0
  114. sage/geometry/triangulation/data.pxd +4 -0
  115. sage/geometry/triangulation/element.py +914 -0
  116. sage/geometry/triangulation/functions.h +10 -0
  117. sage/geometry/triangulation/functions.pxd +4 -0
  118. sage/geometry/triangulation/point_configuration.py +2256 -0
  119. sage/geometry/triangulation/triangulations.h +49 -0
  120. sage/geometry/triangulation/triangulations.pxd +7 -0
  121. sage/geometry/voronoi_diagram.py +319 -0
  122. sage/interfaces/all__sagemath_polyhedra.py +1 -0
  123. sage/interfaces/polymake.py +2028 -0
  124. sage/numerical/all.py +13 -0
  125. sage/numerical/all__sagemath_polyhedra.py +11 -0
  126. sage/numerical/backends/all.py +1 -0
  127. sage/numerical/backends/all__sagemath_polyhedra.py +1 -0
  128. sage/numerical/backends/cvxopt_backend.cpython-314-x86_64-linux-musl.so +0 -0
  129. sage/numerical/backends/cvxopt_backend.pyx +1006 -0
  130. sage/numerical/backends/cvxopt_backend_test.py +19 -0
  131. sage/numerical/backends/cvxopt_sdp_backend.cpython-314-x86_64-linux-musl.so +0 -0
  132. sage/numerical/backends/cvxopt_sdp_backend.pyx +382 -0
  133. sage/numerical/backends/cvxpy_backend.cpython-314-x86_64-linux-musl.so +0 -0
  134. sage/numerical/backends/cvxpy_backend.pxd +41 -0
  135. sage/numerical/backends/cvxpy_backend.pyx +934 -0
  136. sage/numerical/backends/cvxpy_backend_test.py +13 -0
  137. sage/numerical/backends/generic_backend_test.py +24 -0
  138. sage/numerical/backends/interactivelp_backend.cpython-314-x86_64-linux-musl.so +0 -0
  139. sage/numerical/backends/interactivelp_backend.pxd +36 -0
  140. sage/numerical/backends/interactivelp_backend.pyx +1231 -0
  141. sage/numerical/backends/interactivelp_backend_test.py +12 -0
  142. sage/numerical/backends/logging_backend.py +391 -0
  143. sage/numerical/backends/matrix_sdp_backend.cpython-314-x86_64-linux-musl.so +0 -0
  144. sage/numerical/backends/matrix_sdp_backend.pxd +15 -0
  145. sage/numerical/backends/matrix_sdp_backend.pyx +478 -0
  146. sage/numerical/backends/ppl_backend.cpython-314-x86_64-linux-musl.so +0 -0
  147. sage/numerical/backends/ppl_backend.pyx +1126 -0
  148. sage/numerical/backends/ppl_backend_test.py +13 -0
  149. sage/numerical/backends/scip_backend.cpython-314-x86_64-linux-musl.so +0 -0
  150. sage/numerical/backends/scip_backend.pxd +22 -0
  151. sage/numerical/backends/scip_backend.pyx +1289 -0
  152. sage/numerical/backends/scip_backend_test.py +13 -0
  153. sage/numerical/interactive_simplex_method.py +5338 -0
  154. sage/numerical/knapsack.py +665 -0
  155. sage/numerical/linear_functions.cpython-314-x86_64-linux-musl.so +0 -0
  156. sage/numerical/linear_functions.pxd +31 -0
  157. sage/numerical/linear_functions.pyx +1648 -0
  158. sage/numerical/linear_tensor.py +470 -0
  159. sage/numerical/linear_tensor_constraints.py +448 -0
  160. sage/numerical/linear_tensor_element.cpython-314-x86_64-linux-musl.so +0 -0
  161. sage/numerical/linear_tensor_element.pxd +6 -0
  162. sage/numerical/linear_tensor_element.pyx +459 -0
  163. sage/numerical/mip.cpython-314-x86_64-linux-musl.so +0 -0
  164. sage/numerical/mip.pxd +40 -0
  165. sage/numerical/mip.pyx +3667 -0
  166. sage/numerical/sdp.cpython-314-x86_64-linux-musl.so +0 -0
  167. sage/numerical/sdp.pxd +39 -0
  168. sage/numerical/sdp.pyx +1433 -0
  169. sage/rings/all__sagemath_polyhedra.py +3 -0
  170. sage/rings/polynomial/all__sagemath_polyhedra.py +10 -0
  171. sage/rings/polynomial/omega.py +982 -0
  172. sage/schemes/all__sagemath_polyhedra.py +2 -0
  173. sage/schemes/toric/all.py +10 -0
  174. sage/schemes/toric/chow_group.py +1248 -0
  175. sage/schemes/toric/divisor.py +2082 -0
  176. sage/schemes/toric/divisor_class.cpython-314-x86_64-linux-musl.so +0 -0
  177. sage/schemes/toric/divisor_class.pyx +322 -0
  178. sage/schemes/toric/fano_variety.py +1606 -0
  179. sage/schemes/toric/homset.py +650 -0
  180. sage/schemes/toric/ideal.py +451 -0
  181. sage/schemes/toric/library.py +1322 -0
  182. sage/schemes/toric/morphism.py +1958 -0
  183. sage/schemes/toric/points.py +1032 -0
  184. sage/schemes/toric/sheaf/all.py +1 -0
  185. sage/schemes/toric/sheaf/constructor.py +302 -0
  186. sage/schemes/toric/sheaf/klyachko.py +921 -0
  187. sage/schemes/toric/toric_subscheme.py +905 -0
  188. sage/schemes/toric/variety.py +3460 -0
  189. sage/schemes/toric/weierstrass.py +1078 -0
  190. sage/schemes/toric/weierstrass_covering.py +457 -0
  191. sage/schemes/toric/weierstrass_higher.py +288 -0
  192. sage_wheels/share/reflexive_polytopes/Full2d/zzdb.info +10 -0
  193. sage_wheels/share/reflexive_polytopes/Full2d/zzdb.v03 +0 -0
  194. sage_wheels/share/reflexive_polytopes/Full2d/zzdb.v04 +0 -0
  195. sage_wheels/share/reflexive_polytopes/Full2d/zzdb.v05 +1 -0
  196. sage_wheels/share/reflexive_polytopes/Full2d/zzdb.v06 +1 -0
  197. sage_wheels/share/reflexive_polytopes/Full3d/zzdb.info +22 -0
  198. sage_wheels/share/reflexive_polytopes/Full3d/zzdb.v04 +0 -0
  199. sage_wheels/share/reflexive_polytopes/Full3d/zzdb.v05 +0 -0
  200. sage_wheels/share/reflexive_polytopes/Full3d/zzdb.v06 +0 -0
  201. sage_wheels/share/reflexive_polytopes/Full3d/zzdb.v07 +0 -0
  202. sage_wheels/share/reflexive_polytopes/Full3d/zzdb.v08 +0 -0
  203. sage_wheels/share/reflexive_polytopes/Full3d/zzdb.v09 +0 -0
  204. sage_wheels/share/reflexive_polytopes/Full3d/zzdb.v10 +0 -0
  205. sage_wheels/share/reflexive_polytopes/Full3d/zzdb.v11 +1 -0
  206. sage_wheels/share/reflexive_polytopes/Full3d/zzdb.v12 +1 -0
  207. sage_wheels/share/reflexive_polytopes/Full3d/zzdb.v13 +1 -0
  208. sage_wheels/share/reflexive_polytopes/reflexive_polytopes_2d +80 -0
  209. sage_wheels/share/reflexive_polytopes/reflexive_polytopes_3d +37977 -0
@@ -0,0 +1,847 @@
1
+ # sage_setup: distribution = sagemath-polyhedra
2
+ r"""
3
+ Catalog of common polyhedral convex cones
4
+
5
+ This module provides shortcut functions, grouped under the
6
+ globally-available ``cones`` prefix, to create some common cones:
7
+
8
+ - The downward-monotone cone,
9
+ - The nonnegative orthant,
10
+ - The rearrangement cone of order ``p``,
11
+ - The Schur cone,
12
+ - The trivial cone.
13
+
14
+ At the moment, only convex rational polyhedral cones are
15
+ supported---specifically, those cones that can be built using the
16
+ :func:`Cone` constructor. As a result, each shortcut method can be
17
+ passed either an ambient dimension ``ambient_dim``, or a toric
18
+ ``lattice`` (from which the dimension can be inferred) to determine
19
+ the ambient space.
20
+
21
+ Here are some typical usage examples::
22
+
23
+ sage: cones.downward_monotone(3).rays()
24
+ N( 1, 0, 0),
25
+ N( 1, 1, 0),
26
+ N( 1, 1, 1),
27
+ N(-1, -1, -1)
28
+ in 3-d lattice N
29
+
30
+ ::
31
+
32
+ sage: cones.nonnegative_orthant(2).rays()
33
+ N(1, 0),
34
+ N(0, 1)
35
+ in 2-d lattice N
36
+
37
+ ::
38
+
39
+ sage: cones.rearrangement(2,2).rays()
40
+ N( 1, 0),
41
+ N( 1, -1),
42
+ N(-1, 1)
43
+ in 2-d lattice N
44
+
45
+ ::
46
+
47
+ sage: cones.schur(3).rays()
48
+ N(1, -1, 0),
49
+ N(0, 1, -1)
50
+ in 3-d lattice N
51
+
52
+ ::
53
+
54
+ sage: cones.trivial(3).rays()
55
+ Empty collection
56
+ in 3-d lattice N
57
+
58
+ To specify some other lattice, pass it as an argument to the function::
59
+
60
+ sage: K = cones.nonnegative_orthant(3)
61
+ sage: cones.schur(lattice=K.dual().lattice())
62
+ 2-d cone in 3-d lattice M
63
+
64
+ For more information about these cones, see the documentation for the
65
+ individual functions and the references therein.
66
+ """
67
+
68
+ #
69
+ # WARNING:
70
+ #
71
+ # Don't import anything into global scope here. If you do, it will
72
+ # show up in the cones.<tab> list, and that list should contain only
73
+ # the top-level non-underscore functions defined in this module.
74
+ #
75
+
76
+
77
+ def _preprocess_args(ambient_dim, lattice):
78
+ r"""
79
+ Preprocess arguments for cone-constructing functions.
80
+
81
+ Each cone-constructing function in this module performs some
82
+ preprocessing on its ``ambient_dim`` and ``lattice`` arguments to
83
+ ensure that they both wind up defined and compatible with one
84
+ another. In particular, the ``ambient_dim`` can be inferred from
85
+ a ``lattice`` and a default lattice can be chosen based on an
86
+ ``ambient_dim``. Both can be specified so long as the rank of
87
+ the ``lattice`` matches the ``ambient_dim``; it is an error
88
+ if the two numbers are different.
89
+
90
+ Since each function performs exactly the same steps,
91
+
92
+ - Check that either ``ambient_dim`` or ``lattice`` was given,
93
+ - Infer the ``ambient_dim`` from the ``lattice`` if ``lattice``
94
+ was given and ``ambient_dim`` was not,
95
+ - Use the default ``lattice`` if ``ambient_dim`` was given and
96
+ ``lattice`` was not,
97
+ - Ensure that the rank of the ``lattice`` equals ``ambient_dim``,
98
+
99
+ we collect them here.
100
+
101
+ INPUT:
102
+
103
+ - ``ambient_dim`` -- nonnegative integer; the dimension of the
104
+ ambient space in which the cone will live
105
+
106
+ - ``lattice`` -- a toric lattice; the lattice in which the cone
107
+ will live
108
+
109
+ OUTPUT:
110
+
111
+ A pair ``(ambient_dim, lattice)`` containing the processed
112
+ arguments. Both are guaranteed to be defined (that is, not
113
+ ``None``) and the rank of the ``lattice`` will equal
114
+ ``ambient_dim``.
115
+
116
+ EXAMPLES:
117
+
118
+ If the ``lattice`` argument is ``None``, then the default lattice
119
+ with rank equal to ``ambient_dim`` will be used::
120
+
121
+ sage: from sage.geometry.cone_catalog import _preprocess_args
122
+ sage: _preprocess_args(3, None)
123
+ (3, 3-d lattice N)
124
+
125
+ If the ``ambient_dim`` argument is ``None``, then the rank of the
126
+ ``lattice`` will be used as the ambient dimension::
127
+
128
+ sage: from sage.geometry.cone_catalog import _preprocess_args
129
+ sage: _preprocess_args(None, ToricLattice(3))
130
+ (3, 3-d lattice N)
131
+
132
+ So long as the rank of ``lattice`` equals ``ambient_dim``, it is
133
+ not an error for both to be defined::
134
+
135
+ sage: from sage.geometry.cone_catalog import _preprocess_args
136
+ sage: _preprocess_args(3, ToricLattice(3))
137
+ (3, 3-d lattice N)
138
+
139
+ .. NOTE::
140
+
141
+ The two error conditions are tested in the cone-constructing
142
+ functions themselves, which introduces some duplication but
143
+ serves to ensure that ``_preprocess_args()`` is actually called
144
+ in each such function.
145
+ """
146
+ from sage.geometry.toric_lattice import ToricLattice
147
+
148
+ if ambient_dim is None and lattice is None:
149
+ raise ValueError("either the ambient dimension or the lattice "
150
+ "must be specified")
151
+
152
+ if ambient_dim is None:
153
+ ambient_dim = lattice.rank()
154
+
155
+ if lattice is None:
156
+ lattice = ToricLattice(ambient_dim)
157
+
158
+ if lattice.rank() != ambient_dim:
159
+ raise ValueError("lattice rank=%d and ambient_dim=%d "
160
+ "are incompatible" % (lattice.rank(), ambient_dim))
161
+
162
+ return (ambient_dim, lattice)
163
+
164
+
165
+ def downward_monotone(ambient_dim=None, lattice=None):
166
+ r"""
167
+ The downward-monotone cone in ``ambient_dim`` dimensions, or
168
+ living in ``lattice``.
169
+
170
+ The elements of the downward-monotone cone are vectors whose
171
+ components are arranged in non-increasing order. Vectors whose
172
+ entries are arranged in the reverse (non-decreasing) order are
173
+ sometimes called isotone vectors, and are used in statistics
174
+ for isotonic regression.
175
+
176
+ The downward-monotone cone is the dual of the Schur cone. It
177
+ is also often referred to as the downward-monotone cone.
178
+
179
+ INPUT:
180
+
181
+ - ``ambient_dim`` -- nonnegative integer (default: ``None``); the
182
+ dimension of the ambient space
183
+
184
+ - ``lattice`` -- a toric lattice (default: ``None``); the lattice in
185
+ which the cone will live
186
+
187
+ If ``ambient_dim`` is omitted, then it will be inferred from the
188
+ rank of ``lattice``. If the ``lattice`` is omitted, then the
189
+ default lattice of rank ``ambient_dim`` will be used.
190
+
191
+ A :exc:`ValueError` is raised if neither ``ambient_dim`` nor
192
+ ``lattice`` are specified. It is also a :exc:`ValueError` to
193
+ specify both ``ambient_dim`` and ``lattice`` unless the rank of
194
+ ``lattice`` is equal to ``ambient_dim``.
195
+
196
+ OUTPUT:
197
+
198
+ A :class:`~sage.geometry.cone.ConvexRationalPolyhedralCone` living
199
+ in ``lattice`` whose elements' entries are arranged in
200
+ nonincreasing order. Each generating ray has the integer ring as
201
+ its base ring.
202
+
203
+ A :exc:`ValueError` can be raised if the inputs are incompatible
204
+ or insufficient. See the INPUT documentation for details.
205
+
206
+ .. SEEALSO::
207
+
208
+ :func:`schur`
209
+
210
+ REFERENCES:
211
+
212
+ - [GS2010]_, Section 3.1
213
+
214
+ - [Niez1998]_, Example 2.2
215
+
216
+ EXAMPLES:
217
+
218
+ The entries of the elements of the downward-monotone cone are in
219
+ non-increasing order::
220
+
221
+ sage: ambient_dim = ZZ.random_element(10)
222
+ sage: K = cones.downward_monotone(ambient_dim)
223
+ sage: all( x[i] >= x[i + 1]
224
+ ....: for i in range(ambient_dim - 1)
225
+ ....: for x in K.rays() )
226
+ True
227
+ sage: x = K.random_element()
228
+ sage: all( x[i] >= x[i + 1] for i in range(ambient_dim - 1) )
229
+ True
230
+
231
+ A nontrivial downward-monotone cone is solid but not proper,
232
+ since it contains both the vector of all ones and its negation;
233
+ that, however, is the only subspace it contains::
234
+
235
+ sage: ambient_dim = ZZ.random_element(1,10)
236
+ sage: K = cones.downward_monotone(ambient_dim)
237
+ sage: K.is_solid()
238
+ True
239
+ sage: K.is_proper()
240
+ False
241
+ sage: K.lineality()
242
+ 1
243
+
244
+ The dual of the downward-monotone cone is the Schur cone
245
+ [GS2010]_ that induces the majorization preordering::
246
+
247
+ sage: ambient_dim = ZZ.random_element(10)
248
+ sage: K = cones.downward_monotone(ambient_dim).dual()
249
+ sage: J = cones.schur(ambient_dim, K.lattice())
250
+ sage: K.is_equivalent(J)
251
+ True
252
+
253
+ TESTS:
254
+
255
+ We can construct the trivial cone as the downward-monotone cone
256
+ in a trivial vector space::
257
+
258
+ sage: cones.downward_monotone(0)
259
+ 0-d cone in 0-d lattice N
260
+
261
+ If a ``lattice`` was given, it is actually used::
262
+
263
+ sage: L = ToricLattice(3, 'M')
264
+ sage: cones.downward_monotone(lattice=L)
265
+ 3-d cone in 3-d lattice M
266
+
267
+ Unless the rank of the lattice disagrees with ``ambient_dim``::
268
+
269
+ sage: L = ToricLattice(1, 'M')
270
+ sage: cones.downward_monotone(3, lattice=L)
271
+ Traceback (most recent call last):
272
+ ...
273
+ ValueError: lattice rank=1 and ambient_dim=3 are incompatible
274
+
275
+ We also get an error if no arguments are given::
276
+
277
+ sage: cones.downward_monotone()
278
+ Traceback (most recent call last):
279
+ ...
280
+ ValueError: either the ambient dimension or the lattice must
281
+ be specified
282
+ """
283
+ from sage.geometry.cone import Cone
284
+ from sage.matrix.constructor import matrix
285
+ from sage.rings.integer_ring import ZZ
286
+
287
+ ambient_dim, lattice = _preprocess_args(ambient_dim, lattice)
288
+
289
+ # The generators for this cone are mentioned in Niezgoda's
290
+ # Example 2.2 if you don't want to compute them yourself.
291
+ G = matrix.identity(ZZ, ambient_dim)
292
+ for i in range(1, ambient_dim):
293
+ G.add_multiple_of_row(i, i - 1, 1)
294
+
295
+ if G.nrows() > 0:
296
+ # Special case for when the ambient space is trivial.
297
+ G = G.insert_row(ambient_dim, -1*G.row(-1))
298
+
299
+ return Cone(G.rows(), lattice)
300
+
301
+
302
+ def nonnegative_orthant(ambient_dim=None, lattice=None):
303
+ r"""
304
+ The nonnegative orthant in ``ambient_dim`` dimensions, or living
305
+ in ``lattice``.
306
+
307
+ The nonnegative orthant consists of all componentwise-nonnegative
308
+ vectors. It is the convex-conic hull of the standard basis.
309
+
310
+ INPUT:
311
+
312
+ - ``ambient_dim`` -- nonnegative integer (default: ``None``); the
313
+ dimension of the ambient space
314
+
315
+ - ``lattice`` -- a toric lattice (default: ``None``); the lattice in
316
+ which the cone will live
317
+
318
+ If ``ambient_dim`` is omitted, then it will be inferred from the
319
+ rank of ``lattice``. If the ``lattice`` is omitted, then the
320
+ default lattice of rank ``ambient_dim`` will be used.
321
+
322
+ A :exc:`ValueError` is raised if neither ``ambient_dim`` nor
323
+ ``lattice`` are specified. It is also a :exc:`ValueError` to
324
+ specify both ``ambient_dim`` and ``lattice`` unless the rank of
325
+ ``lattice`` is equal to ``ambient_dim``.
326
+
327
+ OUTPUT:
328
+
329
+ A :class:`~sage.geometry.cone.ConvexRationalPolyhedralCone` living
330
+ in ``lattice`` and having ``ambient_dim`` standard basis vectors
331
+ as its generators. Each generating ray has the integer ring as its
332
+ base ring.
333
+
334
+ A :exc:`ValueError` can be raised if the inputs are incompatible
335
+ or insufficient. See the INPUT documentation for details.
336
+
337
+ REFERENCES:
338
+
339
+ - Chapter 2 in [BV2009]_ (Examples 2.4, 2.14, and 2.23 in particular)
340
+
341
+ EXAMPLES::
342
+
343
+ sage: cones.nonnegative_orthant(3).rays()
344
+ N(1, 0, 0),
345
+ N(0, 1, 0),
346
+ N(0, 0, 1)
347
+ in 3-d lattice N
348
+
349
+ TESTS:
350
+
351
+ We can construct the trivial cone as the nonnegative orthant in a
352
+ trivial vector space::
353
+
354
+ sage: cones.nonnegative_orthant(0)
355
+ 0-d cone in 0-d lattice N
356
+
357
+ The nonnegative orthant is a proper cone::
358
+
359
+ sage: ambient_dim = ZZ.random_element(10)
360
+ sage: K = cones.nonnegative_orthant(ambient_dim)
361
+ sage: K.is_proper()
362
+ True
363
+
364
+ If a ``lattice`` was given, it is actually used::
365
+
366
+ sage: L = ToricLattice(3, 'M')
367
+ sage: cones.nonnegative_orthant(lattice=L)
368
+ 3-d cone in 3-d lattice M
369
+
370
+ Unless the rank of the lattice disagrees with ``ambient_dim``::
371
+
372
+ sage: L = ToricLattice(1, 'M')
373
+ sage: cones.nonnegative_orthant(3, lattice=L)
374
+ Traceback (most recent call last):
375
+ ...
376
+ ValueError: lattice rank=1 and ambient_dim=3 are incompatible
377
+
378
+ We also get an error if no arguments are given::
379
+
380
+ sage: cones.nonnegative_orthant()
381
+ Traceback (most recent call last):
382
+ ...
383
+ ValueError: either the ambient dimension or the lattice must
384
+ be specified
385
+ """
386
+ from sage.geometry.cone import Cone
387
+ from sage.matrix.constructor import matrix
388
+ from sage.rings.integer_ring import ZZ
389
+
390
+ ambient_dim, lattice = _preprocess_args(ambient_dim, lattice)
391
+
392
+ I = matrix.identity(ZZ, ambient_dim)
393
+ return Cone(I.rows(), lattice)
394
+
395
+
396
+ def rearrangement(p, ambient_dim=None, lattice=None):
397
+ r"""
398
+ The rearrangement cone of order ``p`` in ``ambient_dim``
399
+ dimensions, or living in ``lattice``.
400
+
401
+ The rearrangement cone of order ``p`` in ``ambient_dim``
402
+ dimensions consists of all vectors of length ``ambient_dim``
403
+ whose smallest ``p`` components sum to a nonnegative number.
404
+
405
+ For example, the rearrangement cone of order one has its single
406
+ smallest component nonnegative. This implies that all components
407
+ are nonnegative, and that therefore the rearrangement cone of
408
+ order one is the nonnegative orthant in its ambient space.
409
+
410
+ When ``p`` and ``ambient_dim`` are equal, all components of the
411
+ cone's elements must sum to a nonnegative number. In other
412
+ words, the rearrangement cone of order ``ambient_dim`` is a
413
+ half-space.
414
+
415
+ INPUT:
416
+
417
+ - ``p`` -- nonnegative integer; the number of components to
418
+ "rearrange", between ``1`` and ``ambient_dim`` inclusive
419
+
420
+ - ``ambient_dim`` -- nonnegative integer (default: ``None``); the
421
+ dimension of the ambient space
422
+
423
+ - ``lattice`` -- a toric lattice (default: ``None``); the lattice in
424
+ which the cone will live
425
+
426
+ If ``ambient_dim`` is omitted, then it will be inferred from the
427
+ rank of ``lattice``. If the ``lattice`` is omitted, then the
428
+ default lattice of rank ``ambient_dim`` will be used.
429
+
430
+ A :exc:`ValueError` is raised if neither ``ambient_dim`` nor
431
+ ``lattice`` are specified. It is also a :exc:`ValueError` to
432
+ specify both ``ambient_dim`` and ``lattice`` unless the rank of
433
+ ``lattice`` is equal to ``ambient_dim``.
434
+
435
+ It is also a :exc:`ValueError` to specify a non-integer ``p``.
436
+
437
+ OUTPUT:
438
+
439
+ A :class:`~sage.geometry.cone.ConvexRationalPolyhedralCone`
440
+ representing the rearrangement cone of order ``p`` living in
441
+ ``lattice``, with ambient dimension ``ambient_dim``. Each
442
+ generating ray has the integer ring as its base ring.
443
+
444
+ A :exc:`ValueError` can be raised if the inputs are incompatible
445
+ or insufficient. See the INPUT documentation for details.
446
+
447
+ ALGORITHM:
448
+
449
+ Suppose that the ambient space is of dimension `n`. The extreme
450
+ directions of the rearrangement cone for `1 \le p \le n-1` are
451
+ given by [Jeong2017]_ Theorem 5.2.3. When `2 \le p \le n-2` (that
452
+ is, if we ignore `p = 1` and `p = n-1`), they consist of
453
+
454
+ - the standard basis `\left\{e_{1},e_{2},\ldots,e_{n}\right\}` for
455
+ the ambient space, and
456
+
457
+ - the `n` vectors `\left(1,1,\ldots,1\right)^{T} - pe_{i}` for
458
+ `i = 1,2,\ldots,n`.
459
+
460
+ Special cases are then given for `p = 1` and `p = n-1` in the
461
+ theorem. However in SageMath we don't need conically-independent
462
+ extreme directions. We only need a generating set, because the
463
+ :func:`Cone` function will eliminate any redundant generators. And
464
+ one can easily verify that the special-case extreme directions for
465
+ `p = 1` and `p = n-1` are contained in the conic hull of the `2n`
466
+ generators just described. The half space resulting from `p = n`
467
+ is also covered by this set of generators, so for all valid `p` we
468
+ simply take the conic hull of those `2n` vectors.
469
+
470
+ REFERENCES:
471
+
472
+ - [GJ2016]_, Section 4
473
+
474
+ - [HS2010]_, Example 2.21
475
+
476
+ - [Jeong2017]_, Section 5.2
477
+
478
+ EXAMPLES:
479
+
480
+ The rearrangement cones of order one are nonnegative orthants::
481
+
482
+ sage: orthant = cones.nonnegative_orthant(6)
483
+ sage: cones.rearrangement(1,6).is_equivalent(orthant)
484
+ True
485
+
486
+ When ``p`` and ``ambient_dim`` are equal, the rearrangement cone
487
+ is a half-space, so we expect its lineality to be one less than
488
+ ``ambient_dim`` because it will contain a hyperplane but is not
489
+ the entire space::
490
+
491
+ sage: cones.rearrangement(5,5).lineality()
492
+ 4
493
+
494
+ Jeong's Proposition 5.2.1 [Jeong2017]_ states that all rearrangement
495
+ cones are proper when ``p`` is less than ``ambient_dim``::
496
+
497
+ sage: all( cones.rearrangement(p, ambient_dim).is_proper()
498
+ ....: for ambient_dim in range(10)
499
+ ....: for p in range(1, ambient_dim) )
500
+ True
501
+
502
+ Jeong's Corollary 5.2.4 [Jeong2017]_ states that if `p = n-1` in
503
+ an `n`-dimensional ambient space, then the Lyapunov rank of the
504
+ rearrangement cone is `n`, and that for all other `p > 1` its
505
+ Lyapunov rank is one::
506
+
507
+ sage: all( cones.rearrangement(p, ambient_dim).lyapunov_rank()
508
+ ....: ==
509
+ ....: ambient_dim
510
+ ....: for ambient_dim in range(2, 10)
511
+ ....: for p in [ ambient_dim-1 ] )
512
+ True
513
+ sage: all( cones.rearrangement(p, ambient_dim).lyapunov_rank() == 1
514
+ ....: for ambient_dim in range(3, 10)
515
+ ....: for p in range(2, ambient_dim-1) )
516
+ True
517
+
518
+ TESTS:
519
+
520
+ Jeong's Proposition 5.2.1 [Jeong2017]_ states that rearrangement
521
+ cones are permutation-invariant::
522
+
523
+ sage: ambient_dim = ZZ.random_element(2,10).abs()
524
+ sage: p = ZZ.random_element(1, ambient_dim)
525
+ sage: K = cones.rearrangement(p, ambient_dim)
526
+ sage: P = SymmetricGroup(ambient_dim).random_element().matrix() # needs sage.groups
527
+ sage: all(K.contains(P*r) for r in K) # needs sage.groups
528
+ True
529
+
530
+ The smallest ``p`` components of every element of the rearrangement
531
+ cone should sum to a nonnegative number. In other words, the
532
+ generators really are what we think they are::
533
+
534
+ sage: def _has_rearrangement_property(v, p):
535
+ ....: return sum( sorted(v)[0:p] ) >= 0
536
+ sage: all(
537
+ ....: _has_rearrangement_property(
538
+ ....: cones.rearrangement(p, ambient_dim).random_element(),
539
+ ....: p
540
+ ....: )
541
+ ....: for ambient_dim in range(2, 10)
542
+ ....: for p in range(1, ambient_dim+1)
543
+ ....: )
544
+ True
545
+
546
+ The rearrangement cone of order ``p`` is, almost by definition,
547
+ contained in the rearrangement cone of order ``p + 1``::
548
+
549
+ sage: ambient_dim = ZZ.random_element(2,10)
550
+ sage: p = ZZ.random_element(1, ambient_dim)
551
+ sage: K1 = cones.rearrangement(p, ambient_dim)
552
+ sage: K2 = cones.rearrangement(p+1, ambient_dim)
553
+ sage: all( x in K2 for x in K1 )
554
+ True
555
+
556
+ Jeong's Proposition 5.2.1 [Jeong2017]_ states that the rearrangement
557
+ cone of order ``p`` is linearly isomorphic to the rearrangement
558
+ cone of order ``ambient_dim - p`` when ``p`` is less than
559
+ ``ambient_dim``::
560
+
561
+ sage: ambient_dim = ZZ.random_element(2,10)
562
+ sage: p = ZZ.random_element(1, ambient_dim)
563
+ sage: K1 = cones.rearrangement(p, ambient_dim)
564
+ sage: K2 = cones.rearrangement(ambient_dim-p, ambient_dim)
565
+ sage: Mp = ((1/p)*matrix.ones(QQ, ambient_dim)
566
+ ....: - matrix.identity(QQ, ambient_dim))
567
+ sage: Cone( (Mp*K2.rays()).columns() ).is_equivalent(K1)
568
+ True
569
+
570
+ The order ``p`` should be an integer between ``1`` and
571
+ ``ambient_dim``, inclusive::
572
+
573
+ sage: cones.rearrangement(0,3)
574
+ Traceback (most recent call last):
575
+ ...
576
+ ValueError: order p=0 should be an integer between 1 and
577
+ ambient_dim=3, inclusive
578
+ sage: cones.rearrangement(5,3)
579
+ Traceback (most recent call last):
580
+ ...
581
+ ValueError: order p=5 should be an integer between 1 and
582
+ ambient_dim=3, inclusive
583
+ sage: cones.rearrangement(3/2, 3)
584
+ Traceback (most recent call last):
585
+ ...
586
+ ValueError: order p=3/2 should be an integer between 1 and
587
+ ambient_dim=3, inclusive
588
+
589
+ If a ``lattice`` was given, it is actually used::
590
+
591
+ sage: L = ToricLattice(3, 'M')
592
+ sage: cones.rearrangement(2, 3, lattice=L)
593
+ 3-d cone in 3-d lattice M
594
+
595
+ Unless the rank of the lattice disagrees with ``ambient_dim``::
596
+
597
+ sage: L = ToricLattice(1, 'M')
598
+ sage: cones.rearrangement(2, 3, lattice=L)
599
+ Traceback (most recent call last):
600
+ ...
601
+ ValueError: lattice rank=1 and ambient_dim=3 are incompatible
602
+
603
+ We also get an error if neither the ambient dimension nor lattice
604
+ are specified::
605
+
606
+ sage: cones.rearrangement(3)
607
+ Traceback (most recent call last):
608
+ ...
609
+ ValueError: either the ambient dimension or the lattice must
610
+ be specified
611
+ """
612
+ from sage.geometry.cone import Cone
613
+ from sage.matrix.constructor import matrix
614
+ from sage.rings.integer_ring import ZZ
615
+
616
+ ambient_dim, lattice = _preprocess_args(ambient_dim, lattice)
617
+
618
+ if p < 1 or p > ambient_dim or p not in ZZ:
619
+ raise ValueError("order p=%s should be an integer between 1 "
620
+ "and ambient_dim=%d, inclusive" % (p, ambient_dim))
621
+
622
+ I = matrix.identity(ZZ, ambient_dim)
623
+ M = matrix.ones(ZZ, ambient_dim) - p * I
624
+ G = matrix.identity(ZZ, ambient_dim).rows() + M.rows()
625
+ return Cone(G, lattice=lattice)
626
+
627
+
628
+ def schur(ambient_dim=None, lattice=None):
629
+ r"""
630
+ The Schur cone in ``ambient_dim`` dimensions, or living
631
+ in ``lattice``.
632
+
633
+ The Schur cone in `n` dimensions induces the majorization
634
+ preordering on the ambient space. If `\left\{e_{1}, e_{2}, \ldots,
635
+ e_{n}\right\}` is the standard basis for the space, then its
636
+ generators are `\left\{e_{i} - e_{i+1}\ |\ 1 \le i \le
637
+ n-1\right\}`. Its dual is the downward monotone cone.
638
+
639
+ INPUT:
640
+
641
+ - ``ambient_dim`` -- nonnegative integer (default: ``None``); the
642
+ dimension of the ambient space
643
+
644
+ - ``lattice`` -- a toric lattice (default: ``None``); the lattice in
645
+ which the cone will live
646
+
647
+ If ``ambient_dim`` is omitted, then it will be inferred from the
648
+ rank of ``lattice``. If the ``lattice`` is omitted, then the
649
+ default lattice of rank ``ambient_dim`` will be used.
650
+
651
+ A :exc:`ValueError` is raised if neither ``ambient_dim`` nor
652
+ ``lattice`` are specified. It is also a :exc:`ValueError` to
653
+ specify both ``ambient_dim`` and ``lattice`` unless the rank of
654
+ ``lattice`` is equal to ``ambient_dim``.
655
+
656
+ OUTPUT:
657
+
658
+ A :class:`~sage.geometry.cone.ConvexRationalPolyhedralCone`
659
+ representing the Schur cone living in ``lattice``, with ambient
660
+ dimension ``ambient_dim``. Each generating ray has the integer
661
+ ring as its base ring.
662
+
663
+ A :exc:`ValueError` can be raised if the inputs are incompatible
664
+ or insufficient. See the INPUT documentation for details.
665
+
666
+ .. SEEALSO::
667
+
668
+ :func:`downward_monotone`
669
+
670
+ REFERENCES:
671
+
672
+ - [GS2010]_, Section 3.1
673
+
674
+ - [IS2005]_, Example 7.3
675
+
676
+ - [SS2016]_, Example 7.4
677
+
678
+ EXAMPLES:
679
+
680
+ Verify the claim [SS2016]_ that the maximal angle between any two
681
+ generators of the Schur cone and the nonnegative orthant in
682
+ dimension five is `\left(3/4\right)\pi`::
683
+
684
+ sage: # needs sage.rings.number_field
685
+ sage: P = cones.schur(5)
686
+ sage: Q = cones.nonnegative_orthant(5)
687
+ sage: G = ( g.change_ring(QQbar).normalized() for g in P )
688
+ sage: H = ( h.change_ring(QQbar).normalized() for h in Q )
689
+ sage: actual = max(arccos(u.inner_product(v)) for u in G for v in H) # needs sage.symbolic
690
+ sage: expected = 3*pi/4 # needs sage.symbolic
691
+ sage: abs(actual - expected).n() < 1e-12 # needs sage.symbolic
692
+ True
693
+
694
+ The dual of the Schur cone is the downward-monotone cone
695
+ [GS2010]_, whose elements' entries are in non-increasing order::
696
+
697
+ sage: ambient_dim = ZZ.random_element(10)
698
+ sage: K = cones.schur(ambient_dim).dual()
699
+ sage: J = cones.downward_monotone(ambient_dim, K.lattice())
700
+ sage: K.is_equivalent(J)
701
+ True
702
+
703
+ TESTS:
704
+
705
+ We get the trivial cone when ``ambient_dim`` is zero::
706
+
707
+ sage: cones.schur(0).is_trivial()
708
+ True
709
+
710
+ The Schur cone induces the majorization preordering, as in Iusem
711
+ and Seeger's [IS2005]_ Example 7.3 or Niezgoda's [Niez1998]_
712
+ Example 2.2::
713
+
714
+ sage: ambient_dim = ZZ.random_element(10)
715
+ sage: V = VectorSpace(QQ, ambient_dim)
716
+ sage: rearrange = lambda z: V(sorted(z.list(),reverse=True))
717
+ sage: def majorized_by(x, y):
718
+ ....: x = rearrange(x)
719
+ ....: y = rearrange(y)
720
+ ....: return (all(sum(x[0:i]) <= sum(y[0:i])
721
+ ....: for i in range(x.degree()-1))
722
+ ....: and sum(x) == sum(y))
723
+ sage: S = cones.schur(ambient_dim)
724
+ sage: majorized_by(V.zero(), S.random_element())
725
+ True
726
+ sage: x = V.random_element()
727
+ sage: y = V.random_element()
728
+ sage: majorized_by(x,y) == ((rearrange(y) - rearrange(x)) in S)
729
+ True
730
+
731
+ If a ``lattice`` was given, it is actually used::
732
+
733
+ sage: L = ToricLattice(3, 'M')
734
+ sage: cones.schur(3, lattice=L)
735
+ 2-d cone in 3-d lattice M
736
+
737
+ Unless the rank of the lattice disagrees with ``ambient_dim``::
738
+
739
+ sage: L = ToricLattice(1, 'M')
740
+ sage: cones.schur(3, lattice=L)
741
+ Traceback (most recent call last):
742
+ ...
743
+ ValueError: lattice rank=1 and ambient_dim=3 are incompatible
744
+
745
+ We also get an error if no arguments are given::
746
+
747
+ sage: cones.schur()
748
+ Traceback (most recent call last):
749
+ ...
750
+ ValueError: either the ambient dimension or the lattice must
751
+ be specified
752
+ """
753
+ from sage.geometry.cone import Cone
754
+ from sage.matrix.constructor import matrix
755
+ from sage.rings.integer_ring import ZZ
756
+
757
+ ambient_dim, lattice = _preprocess_args(ambient_dim, lattice)
758
+
759
+ def _f(i, j):
760
+ if i == j:
761
+ return 1
762
+ elif j - i == 1:
763
+ return -1
764
+ else:
765
+ return 0
766
+
767
+ # The "max" below catches the trivial case where ambient_dim == 0.
768
+ S = matrix(ZZ, max(0, ambient_dim-1), ambient_dim, _f)
769
+
770
+ return Cone(S.rows(), lattice)
771
+
772
+
773
+ def trivial(ambient_dim=None, lattice=None):
774
+ r"""
775
+ The trivial cone with no nonzero generators in ``ambient_dim``
776
+ dimensions, or living in ``lattice``.
777
+
778
+ INPUT:
779
+
780
+ - ``ambient_dim`` -- nonnegative integer (default: ``None``); the
781
+ dimension of the ambient space
782
+
783
+ - ``lattice`` -- a toric lattice (default: ``None``); the lattice in
784
+ which the cone will live
785
+
786
+ If ``ambient_dim`` is omitted, then it will be inferred from the
787
+ rank of ``lattice``. If the ``lattice`` is omitted, then the
788
+ default lattice of rank ``ambient_dim`` will be used.
789
+
790
+ A :exc:`ValueError` is raised if neither ``ambient_dim`` nor
791
+ ``lattice`` are specified. It is also a :exc:`ValueError` to
792
+ specify both ``ambient_dim`` and ``lattice`` unless the rank of
793
+ ``lattice`` is equal to ``ambient_dim``.
794
+
795
+ OUTPUT:
796
+
797
+ A :class:`~sage.geometry.cone.ConvexRationalPolyhedralCone`
798
+ representing the trivial cone with no nonzero generators living in
799
+ ``lattice``, with ambient dimension ``ambient_dim``.
800
+
801
+ A :exc:`ValueError` can be raised if the inputs are incompatible
802
+ or insufficient. See the INPUT documentation for details.
803
+
804
+ EXAMPLES:
805
+
806
+ Construct the trivial cone, containing only the origin, in three
807
+ dimensions::
808
+
809
+ sage: cones.trivial(3)
810
+ 0-d cone in 3-d lattice N
811
+
812
+ If a ``lattice`` is given, the trivial cone will live in that
813
+ lattice::
814
+
815
+ sage: L = ToricLattice(3, 'M')
816
+ sage: cones.trivial(3, lattice=L)
817
+ 0-d cone in 3-d lattice M
818
+
819
+ TESTS:
820
+
821
+ We can construct the trivial cone in a trivial ambient space::
822
+
823
+ sage: cones.trivial(0)
824
+ 0-d cone in 0-d lattice N
825
+
826
+ An error is raised if the rank of the lattice disagrees with
827
+ ``ambient_dim``::
828
+
829
+ sage: L = ToricLattice(1, 'M')
830
+ sage: cones.trivial(3, lattice=L)
831
+ Traceback (most recent call last):
832
+ ...
833
+ ValueError: lattice rank=1 and ambient_dim=3 are incompatible
834
+
835
+ We also get an error if no arguments are given::
836
+
837
+ sage: cones.trivial()
838
+ Traceback (most recent call last):
839
+ ...
840
+ ValueError: either the ambient dimension or the lattice must
841
+ be specified
842
+ """
843
+ from sage.geometry.cone import Cone
844
+
845
+ ambient_dim, lattice = _preprocess_args(ambient_dim, lattice)
846
+
847
+ return Cone([], lattice)