passagemath-polyhedra 10.6.31rc3__cp314-cp314-musllinux_1_2_x86_64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of passagemath-polyhedra might be problematic. Click here for more details.

Files changed (208) 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 +208 -0
  4. passagemath_polyhedra-10.6.31rc3.dist-info/WHEEL +5 -0
  5. passagemath_polyhedra-10.6.31rc3.dist-info/top_level.txt +2 -0
  6. passagemath_polyhedra.libs/libgcc_s-0cd532bd.so.1 +0 -0
  7. passagemath_polyhedra.libs/libgmp-0e7fc84e.so.10.5.0 +0 -0
  8. passagemath_polyhedra.libs/libgomp-8949ffbe.so.1.0.0 +0 -0
  9. passagemath_polyhedra.libs/libstdc++-5d72f927.so.6.0.33 +0 -0
  10. sage/all__sagemath_polyhedra.py +50 -0
  11. sage/game_theory/all.py +8 -0
  12. sage/game_theory/catalog.py +6 -0
  13. sage/game_theory/catalog_normal_form_games.py +923 -0
  14. sage/game_theory/cooperative_game.py +844 -0
  15. sage/game_theory/matching_game.py +1181 -0
  16. sage/game_theory/normal_form_game.py +2697 -0
  17. sage/game_theory/parser.py +275 -0
  18. sage/geometry/all__sagemath_polyhedra.py +22 -0
  19. sage/geometry/cone.py +6940 -0
  20. sage/geometry/cone_catalog.py +847 -0
  21. sage/geometry/cone_critical_angles.py +1027 -0
  22. sage/geometry/convex_set.py +1119 -0
  23. sage/geometry/fan.py +3743 -0
  24. sage/geometry/fan_isomorphism.py +389 -0
  25. sage/geometry/fan_morphism.py +1884 -0
  26. sage/geometry/hasse_diagram.py +202 -0
  27. sage/geometry/hyperplane_arrangement/affine_subspace.py +390 -0
  28. sage/geometry/hyperplane_arrangement/all.py +1 -0
  29. sage/geometry/hyperplane_arrangement/arrangement.py +3895 -0
  30. sage/geometry/hyperplane_arrangement/check_freeness.py +145 -0
  31. sage/geometry/hyperplane_arrangement/hyperplane.py +773 -0
  32. sage/geometry/hyperplane_arrangement/library.py +825 -0
  33. sage/geometry/hyperplane_arrangement/ordered_arrangement.py +642 -0
  34. sage/geometry/hyperplane_arrangement/plot.py +520 -0
  35. sage/geometry/integral_points.py +35 -0
  36. sage/geometry/integral_points_generic_dense.cpython-314-x86_64-linux-musl.so +0 -0
  37. sage/geometry/integral_points_generic_dense.pyx +7 -0
  38. sage/geometry/lattice_polytope.py +5894 -0
  39. sage/geometry/linear_expression.py +773 -0
  40. sage/geometry/newton_polygon.py +767 -0
  41. sage/geometry/point_collection.cpython-314-x86_64-linux-musl.so +0 -0
  42. sage/geometry/point_collection.pyx +1008 -0
  43. sage/geometry/polyhedral_complex.py +2616 -0
  44. sage/geometry/polyhedron/all.py +8 -0
  45. sage/geometry/polyhedron/backend_cdd.py +460 -0
  46. sage/geometry/polyhedron/backend_cdd_rdf.py +231 -0
  47. sage/geometry/polyhedron/backend_field.py +347 -0
  48. sage/geometry/polyhedron/backend_normaliz.py +2503 -0
  49. sage/geometry/polyhedron/backend_number_field.py +168 -0
  50. sage/geometry/polyhedron/backend_polymake.py +765 -0
  51. sage/geometry/polyhedron/backend_ppl.py +582 -0
  52. sage/geometry/polyhedron/base.py +1206 -0
  53. sage/geometry/polyhedron/base0.py +1444 -0
  54. sage/geometry/polyhedron/base1.py +886 -0
  55. sage/geometry/polyhedron/base2.py +812 -0
  56. sage/geometry/polyhedron/base3.py +1845 -0
  57. sage/geometry/polyhedron/base4.py +1262 -0
  58. sage/geometry/polyhedron/base5.py +2700 -0
  59. sage/geometry/polyhedron/base6.py +1741 -0
  60. sage/geometry/polyhedron/base7.py +997 -0
  61. sage/geometry/polyhedron/base_QQ.py +1258 -0
  62. sage/geometry/polyhedron/base_RDF.py +98 -0
  63. sage/geometry/polyhedron/base_ZZ.py +934 -0
  64. sage/geometry/polyhedron/base_mutable.py +215 -0
  65. sage/geometry/polyhedron/base_number_field.py +122 -0
  66. sage/geometry/polyhedron/cdd_file_format.py +155 -0
  67. sage/geometry/polyhedron/combinatorial_polyhedron/all.py +1 -0
  68. sage/geometry/polyhedron/combinatorial_polyhedron/base.cpython-314-x86_64-linux-musl.so +0 -0
  69. sage/geometry/polyhedron/combinatorial_polyhedron/base.pxd +76 -0
  70. sage/geometry/polyhedron/combinatorial_polyhedron/base.pyx +3859 -0
  71. sage/geometry/polyhedron/combinatorial_polyhedron/combinatorial_face.cpython-314-x86_64-linux-musl.so +0 -0
  72. sage/geometry/polyhedron/combinatorial_polyhedron/combinatorial_face.pxd +39 -0
  73. sage/geometry/polyhedron/combinatorial_polyhedron/combinatorial_face.pyx +1038 -0
  74. sage/geometry/polyhedron/combinatorial_polyhedron/conversions.cpython-314-x86_64-linux-musl.so +0 -0
  75. sage/geometry/polyhedron/combinatorial_polyhedron/conversions.pxd +9 -0
  76. sage/geometry/polyhedron/combinatorial_polyhedron/conversions.pyx +501 -0
  77. sage/geometry/polyhedron/combinatorial_polyhedron/face_data_structure.pxd +207 -0
  78. sage/geometry/polyhedron/combinatorial_polyhedron/face_iterator.cpython-314-x86_64-linux-musl.so +0 -0
  79. sage/geometry/polyhedron/combinatorial_polyhedron/face_iterator.pxd +102 -0
  80. sage/geometry/polyhedron/combinatorial_polyhedron/face_iterator.pyx +2274 -0
  81. sage/geometry/polyhedron/combinatorial_polyhedron/face_list_data_structure.cpython-314-x86_64-linux-musl.so +0 -0
  82. sage/geometry/polyhedron/combinatorial_polyhedron/face_list_data_structure.pxd +370 -0
  83. sage/geometry/polyhedron/combinatorial_polyhedron/face_list_data_structure.pyx +84 -0
  84. sage/geometry/polyhedron/combinatorial_polyhedron/list_of_faces.cpython-314-x86_64-linux-musl.so +0 -0
  85. sage/geometry/polyhedron/combinatorial_polyhedron/list_of_faces.pxd +31 -0
  86. sage/geometry/polyhedron/combinatorial_polyhedron/list_of_faces.pyx +587 -0
  87. sage/geometry/polyhedron/combinatorial_polyhedron/polyhedron_face_lattice.cpython-314-x86_64-linux-musl.so +0 -0
  88. sage/geometry/polyhedron/combinatorial_polyhedron/polyhedron_face_lattice.pxd +52 -0
  89. sage/geometry/polyhedron/combinatorial_polyhedron/polyhedron_face_lattice.pyx +560 -0
  90. sage/geometry/polyhedron/constructor.py +773 -0
  91. sage/geometry/polyhedron/double_description.py +753 -0
  92. sage/geometry/polyhedron/double_description_inhomogeneous.py +564 -0
  93. sage/geometry/polyhedron/face.py +1060 -0
  94. sage/geometry/polyhedron/generating_function.py +1810 -0
  95. sage/geometry/polyhedron/lattice_euclidean_group_element.py +178 -0
  96. sage/geometry/polyhedron/library.py +3502 -0
  97. sage/geometry/polyhedron/misc.py +121 -0
  98. sage/geometry/polyhedron/modules/all.py +1 -0
  99. sage/geometry/polyhedron/modules/formal_polyhedra_module.py +155 -0
  100. sage/geometry/polyhedron/palp_database.py +447 -0
  101. sage/geometry/polyhedron/parent.py +1279 -0
  102. sage/geometry/polyhedron/plot.py +1986 -0
  103. sage/geometry/polyhedron/ppl_lattice_polygon.py +556 -0
  104. sage/geometry/polyhedron/ppl_lattice_polytope.py +1257 -0
  105. sage/geometry/polyhedron/representation.py +1723 -0
  106. sage/geometry/pseudolines.py +515 -0
  107. sage/geometry/relative_interior.py +445 -0
  108. sage/geometry/toric_plotter.py +1103 -0
  109. sage/geometry/triangulation/all.py +2 -0
  110. sage/geometry/triangulation/base.cpython-314-x86_64-linux-musl.so +0 -0
  111. sage/geometry/triangulation/base.pyx +963 -0
  112. sage/geometry/triangulation/data.h +147 -0
  113. sage/geometry/triangulation/data.pxd +4 -0
  114. sage/geometry/triangulation/element.py +914 -0
  115. sage/geometry/triangulation/functions.h +10 -0
  116. sage/geometry/triangulation/functions.pxd +4 -0
  117. sage/geometry/triangulation/point_configuration.py +2256 -0
  118. sage/geometry/triangulation/triangulations.h +49 -0
  119. sage/geometry/triangulation/triangulations.pxd +7 -0
  120. sage/geometry/voronoi_diagram.py +319 -0
  121. sage/interfaces/all__sagemath_polyhedra.py +1 -0
  122. sage/interfaces/polymake.py +2028 -0
  123. sage/numerical/all.py +13 -0
  124. sage/numerical/all__sagemath_polyhedra.py +11 -0
  125. sage/numerical/backends/all.py +1 -0
  126. sage/numerical/backends/all__sagemath_polyhedra.py +1 -0
  127. sage/numerical/backends/cvxopt_backend.cpython-314-x86_64-linux-musl.so +0 -0
  128. sage/numerical/backends/cvxopt_backend.pyx +1006 -0
  129. sage/numerical/backends/cvxopt_backend_test.py +19 -0
  130. sage/numerical/backends/cvxopt_sdp_backend.cpython-314-x86_64-linux-musl.so +0 -0
  131. sage/numerical/backends/cvxopt_sdp_backend.pyx +382 -0
  132. sage/numerical/backends/cvxpy_backend.cpython-314-x86_64-linux-musl.so +0 -0
  133. sage/numerical/backends/cvxpy_backend.pxd +41 -0
  134. sage/numerical/backends/cvxpy_backend.pyx +934 -0
  135. sage/numerical/backends/cvxpy_backend_test.py +13 -0
  136. sage/numerical/backends/generic_backend_test.py +24 -0
  137. sage/numerical/backends/interactivelp_backend.cpython-314-x86_64-linux-musl.so +0 -0
  138. sage/numerical/backends/interactivelp_backend.pxd +36 -0
  139. sage/numerical/backends/interactivelp_backend.pyx +1231 -0
  140. sage/numerical/backends/interactivelp_backend_test.py +12 -0
  141. sage/numerical/backends/logging_backend.py +391 -0
  142. sage/numerical/backends/matrix_sdp_backend.cpython-314-x86_64-linux-musl.so +0 -0
  143. sage/numerical/backends/matrix_sdp_backend.pxd +15 -0
  144. sage/numerical/backends/matrix_sdp_backend.pyx +478 -0
  145. sage/numerical/backends/ppl_backend.cpython-314-x86_64-linux-musl.so +0 -0
  146. sage/numerical/backends/ppl_backend.pyx +1126 -0
  147. sage/numerical/backends/ppl_backend_test.py +13 -0
  148. sage/numerical/backends/scip_backend.cpython-314-x86_64-linux-musl.so +0 -0
  149. sage/numerical/backends/scip_backend.pxd +22 -0
  150. sage/numerical/backends/scip_backend.pyx +1289 -0
  151. sage/numerical/backends/scip_backend_test.py +13 -0
  152. sage/numerical/interactive_simplex_method.py +5338 -0
  153. sage/numerical/knapsack.py +665 -0
  154. sage/numerical/linear_functions.cpython-314-x86_64-linux-musl.so +0 -0
  155. sage/numerical/linear_functions.pxd +31 -0
  156. sage/numerical/linear_functions.pyx +1648 -0
  157. sage/numerical/linear_tensor.py +470 -0
  158. sage/numerical/linear_tensor_constraints.py +448 -0
  159. sage/numerical/linear_tensor_element.cpython-314-x86_64-linux-musl.so +0 -0
  160. sage/numerical/linear_tensor_element.pxd +6 -0
  161. sage/numerical/linear_tensor_element.pyx +459 -0
  162. sage/numerical/mip.cpython-314-x86_64-linux-musl.so +0 -0
  163. sage/numerical/mip.pxd +40 -0
  164. sage/numerical/mip.pyx +3667 -0
  165. sage/numerical/sdp.cpython-314-x86_64-linux-musl.so +0 -0
  166. sage/numerical/sdp.pxd +39 -0
  167. sage/numerical/sdp.pyx +1433 -0
  168. sage/rings/all__sagemath_polyhedra.py +3 -0
  169. sage/rings/polynomial/all__sagemath_polyhedra.py +10 -0
  170. sage/rings/polynomial/omega.py +982 -0
  171. sage/schemes/all__sagemath_polyhedra.py +2 -0
  172. sage/schemes/toric/all.py +10 -0
  173. sage/schemes/toric/chow_group.py +1248 -0
  174. sage/schemes/toric/divisor.py +2082 -0
  175. sage/schemes/toric/divisor_class.cpython-314-x86_64-linux-musl.so +0 -0
  176. sage/schemes/toric/divisor_class.pyx +322 -0
  177. sage/schemes/toric/fano_variety.py +1606 -0
  178. sage/schemes/toric/homset.py +650 -0
  179. sage/schemes/toric/ideal.py +451 -0
  180. sage/schemes/toric/library.py +1322 -0
  181. sage/schemes/toric/morphism.py +1958 -0
  182. sage/schemes/toric/points.py +1032 -0
  183. sage/schemes/toric/sheaf/all.py +1 -0
  184. sage/schemes/toric/sheaf/constructor.py +302 -0
  185. sage/schemes/toric/sheaf/klyachko.py +921 -0
  186. sage/schemes/toric/toric_subscheme.py +905 -0
  187. sage/schemes/toric/variety.py +3460 -0
  188. sage/schemes/toric/weierstrass.py +1078 -0
  189. sage/schemes/toric/weierstrass_covering.py +457 -0
  190. sage/schemes/toric/weierstrass_higher.py +288 -0
  191. sage_wheels/share/reflexive_polytopes/Full2d/zzdb.info +10 -0
  192. sage_wheels/share/reflexive_polytopes/Full2d/zzdb.v03 +0 -0
  193. sage_wheels/share/reflexive_polytopes/Full2d/zzdb.v04 +0 -0
  194. sage_wheels/share/reflexive_polytopes/Full2d/zzdb.v05 +1 -0
  195. sage_wheels/share/reflexive_polytopes/Full2d/zzdb.v06 +1 -0
  196. sage_wheels/share/reflexive_polytopes/Full3d/zzdb.info +22 -0
  197. sage_wheels/share/reflexive_polytopes/Full3d/zzdb.v04 +0 -0
  198. sage_wheels/share/reflexive_polytopes/Full3d/zzdb.v05 +0 -0
  199. sage_wheels/share/reflexive_polytopes/Full3d/zzdb.v06 +0 -0
  200. sage_wheels/share/reflexive_polytopes/Full3d/zzdb.v07 +0 -0
  201. sage_wheels/share/reflexive_polytopes/Full3d/zzdb.v08 +0 -0
  202. sage_wheels/share/reflexive_polytopes/Full3d/zzdb.v09 +0 -0
  203. sage_wheels/share/reflexive_polytopes/Full3d/zzdb.v10 +0 -0
  204. sage_wheels/share/reflexive_polytopes/Full3d/zzdb.v11 +1 -0
  205. sage_wheels/share/reflexive_polytopes/Full3d/zzdb.v12 +1 -0
  206. sage_wheels/share/reflexive_polytopes/Full3d/zzdb.v13 +1 -0
  207. sage_wheels/share/reflexive_polytopes/reflexive_polytopes_2d +80 -0
  208. sage_wheels/share/reflexive_polytopes/reflexive_polytopes_3d +37977 -0
@@ -0,0 +1,1322 @@
1
+ # sage_setup: distribution = sagemath-polyhedra
2
+ # sage.doctest: needs sage.geometry.polyhedron sage.graphs
3
+ r"""
4
+ Library of toric varieties
5
+
6
+ This module provides a simple way to construct often-used toric
7
+ varieties. Please see the help for the individual methods of
8
+ ``toric_varieties`` for a more detailed description of which varieties
9
+ can be constructed.
10
+
11
+ AUTHORS:
12
+
13
+ - Volker Braun (2010-07-02): initial version
14
+
15
+ EXAMPLES::
16
+
17
+ sage: toric_varieties.dP6()
18
+ 2-d CPR-Fano toric variety covered by 6 affine patches
19
+
20
+ You can assign the homogeneous coordinates to Sage variables either
21
+ with
22
+ :meth:`~sage.schemes.toric.variety.ToricVariety_field.inject_variables`
23
+ or immediately during assignment like this::
24
+
25
+ sage: P2.<x,y,z> = toric_varieties.P2()
26
+ sage: x^2 + y^2 + z^2
27
+ x^2 + y^2 + z^2
28
+ sage: P2.coordinate_ring()
29
+ Multivariate Polynomial Ring in x, y, z over Rational Field
30
+ """
31
+
32
+ # ****************************************************************************
33
+ # Copyright (C) 2010 Volker Braun <vbraun.name@gmail.com>
34
+ # Copyright (C) 2010 Andrey Novoseltsev <novoselt@gmail.com>
35
+ #
36
+ # This program is free software: you can redistribute it and/or modify
37
+ # it under the terms of the GNU General Public License as published by
38
+ # the Free Software Foundation, either version 2 of the License, or
39
+ # (at your option) any later version.
40
+ # https://www.gnu.org/licenses/
41
+ # ****************************************************************************
42
+
43
+ from sage.structure.sage_object import SageObject
44
+
45
+ from sage.matrix.constructor import matrix
46
+ from sage.matrix.special import identity_matrix
47
+ from sage.geometry.fan import Fan
48
+ from sage.geometry.lattice_polytope import LatticePolytope
49
+ from sage.geometry.toric_lattice import ToricLattice
50
+ from sage.rings.integer_ring import ZZ
51
+ from sage.rings.rational_field import QQ
52
+ from sage.arith.misc import GCD as gcd
53
+ from sage.schemes.toric.variety import (DEFAULT_PREFIX,
54
+ ToricVariety,
55
+ normalize_names)
56
+ from sage.schemes.toric.fano_variety import CPRFanoToricVariety
57
+
58
+
59
+ # The combinatorial data of the toric varieties is stored separately here
60
+ # since we might want to use it later on to do the reverse lookup.
61
+ toric_varieties_rays_cones = {
62
+ 'dP6': [
63
+ [(0, 1), (-1, 0), (-1, -1), (0, -1), (1, 0), (1, 1)],
64
+ [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 0]]],
65
+ 'dP7': [
66
+ [(0, 1), (-1, 0), (-1, -1), (0, -1), (1, 0)],
67
+ [[0, 1], [1, 2], [2, 3], [3, 4], [4, 0]]],
68
+ 'dP8': [
69
+ [(1, 1), (0, 1), (-1, -1), (1, 0)],
70
+ [[0, 1], [1, 2], [2, 3], [3, 0]]
71
+ ],
72
+ 'P1xP1': [
73
+ [(1, 0), (-1, 0), (0, 1), (0, -1)],
74
+ [[0, 2], [2, 1], [1, 3], [3, 0]]],
75
+ 'P1xP1_Z2': [
76
+ [(1, 1), (-1, -1), (-1, 1), (1, -1)],
77
+ [[0, 2], [2, 1], [1, 3], [3, 0]]],
78
+ 'P1': [
79
+ [(1,), (-1,)],
80
+ [[0], [1]]],
81
+ 'P2': [
82
+ [(1, 0), (0, 1), (-1, -1)],
83
+ [[0, 1], [1, 2], [2, 0]]],
84
+ 'A1': [
85
+ [(1,)],
86
+ [[0]]],
87
+ 'A2': [
88
+ [(1, 0), (0, 1)],
89
+ [[0, 1]]],
90
+ 'A2_Z2': [
91
+ [(1, 0), (1, 2)],
92
+ [[0, 1]]],
93
+ 'P1xA1': [
94
+ [(1, 0), (-1, 0), (0, 1)],
95
+ [[0, 2], [2, 1]]],
96
+ 'Conifold': [
97
+ [(0, 0, 1), (0, 1, 1), (1, 0, 1), (1, 1, 1)],
98
+ [[0, 1, 2, 3]]],
99
+ 'dP6xdP6': [
100
+ [(0, 1, 0, 0), (-1, 0, 0, 0), (-1, -1, 0, 0),
101
+ (0, -1, 0, 0), (1, 0, 0, 0), (1, 1, 0, 0),
102
+ (0, 0, 0, 1), (0, 0, -1, 0), (0, 0, -1, -1),
103
+ (0, 0, 0, -1), (0, 0, 1, 0), (0, 0, 1, 1)],
104
+ [[0, 1, 6, 7], [0, 1, 7, 8], [0, 1, 8, 9], [0, 1, 9, 10],
105
+ [0, 1, 10, 11], [0, 1, 6, 11], [1, 2, 6, 7], [1, 2, 7, 8],
106
+ [1, 2, 8, 9], [1, 2, 9, 10], [1, 2, 10, 11], [1, 2, 6, 11],
107
+ [2, 3, 6, 7], [2, 3, 7, 8], [2, 3, 8, 9], [2, 3, 9, 10],
108
+ [2, 3, 10, 11], [2, 3, 6, 11], [3, 4, 6, 7], [3, 4, 7, 8],
109
+ [3, 4, 8, 9], [3, 4, 9, 10], [3, 4, 10, 11], [3, 4, 6, 11],
110
+ [4, 5, 6, 7], [4, 5, 7, 8], [4, 5, 8, 9], [4, 5, 9, 10],
111
+ [4, 5, 10, 11], [4, 5, 6, 11], [0, 5, 6, 7], [0, 5, 7, 8],
112
+ [0, 5, 8, 9], [0, 5, 9, 10], [0, 5, 10, 11], [0, 5, 6, 11]]],
113
+ 'Cube_face_fan': [
114
+ [(1, 1, 1), (1, -1, 1), (-1, 1, 1), (-1, -1, 1),
115
+ (-1, -1, -1), (-1, 1, -1), (1, -1, -1), (1, 1, -1)],
116
+ [[0, 1, 2, 3], [4, 5, 6, 7], [0, 1, 7, 6], [4, 5, 3, 2], [0, 2, 5, 7], [4, 6, 1, 3]]],
117
+ 'Cube_sublattice': [
118
+ [(1, 0, 0), (0, 1, 0), (0, 0, 1), (-1, 1, 1),
119
+ (-1, 0, 0), (0, -1, 0), (0, 0, -1), (1, -1, -1)],
120
+ [[0, 1, 2, 3], [4, 5, 6, 7], [0, 1, 7, 6], [4, 5, 3, 2], [0, 2, 5, 7], [4, 6, 1, 3]]],
121
+ 'Cube_nonpolyhedral': [
122
+ [(1, 2, 3), (1, -1, 1), (-1, 1, 1), (-1, -1, 1),
123
+ (-1, -1, -1), (-1, 1, -1), (1, -1, -1), (1, 1, -1)],
124
+ [[0, 1, 2, 3], [4, 5, 6, 7], [0, 1, 7, 6], [4, 5, 3, 2], [0, 2, 5, 7], [4, 6, 1, 3]]],
125
+ 'BCdlOG': [
126
+ [(-1, 0, 0, 2, 3), # 0
127
+ (0, -1, 0, 2, 3), # 1
128
+ (0, 0, -1, 2, 3), # 2
129
+ (0, 0, -1, 1, 2), # 3
130
+ (0, 0, 0, -1, 0), # 4
131
+ (0, 0, 0, 0, -1), # 5
132
+ (0, 0, 0, 2, 3), # 6
133
+ (0, 0, 1, 2, 3), # 7
134
+ (0, 0, 2, 2, 3), # 8
135
+ (0, 0, 1, 1, 1), # 9
136
+ (0, 1, 2, 2, 3), # 10
137
+ (0, 1, 3, 2, 3), # 11
138
+ (1, 0, 4, 2, 3)], # 12
139
+ [[0, 6, 7, 1, 4], [0, 6, 10, 2, 4], [0, 6, 1, 2, 4], [0, 9, 7, 1, 5], [0, 6, 7, 1, 5],
140
+ [0, 6, 10, 2, 5], [0, 6, 1, 2, 5], [0, 9, 1, 4, 5], [0, 6, 10, 4, 11], [0, 6, 7, 4, 11],
141
+ [0, 6, 10, 5, 11], [0, 9, 7, 5, 11], [0, 6, 7, 5, 11], [0, 9, 4, 5, 11], [0, 10, 4, 5, 11],
142
+ [0, 9, 7, 1, 8], [0, 9, 1, 4, 8], [0, 7, 1, 4, 8], [0, 9, 7, 11, 8], [0, 9, 4, 11, 8],
143
+ [0, 7, 4, 11, 8], [0, 10, 2, 4, 3], [0, 1, 2, 4, 3], [0, 10, 2, 5, 3], [0, 1, 2, 5, 3],
144
+ [0, 10, 4, 5, 3], [0, 1, 4, 5, 3], [12, 6, 7, 1, 4], [12, 6, 10, 2, 4], [12, 6, 1, 2, 4],
145
+ [12, 9, 7, 1, 5], [12, 6, 7, 1, 5], [12, 6, 10, 2, 5], [12, 6, 1, 2, 5], [12, 9, 1, 4, 5],
146
+ [12, 6, 10, 4, 11], [12, 6, 7, 4, 11], [12, 6, 10, 5, 11], [12, 9, 7, 5, 11], [12, 6, 7, 5, 11],
147
+ [12, 9, 4, 5, 11], [12, 10, 4, 5, 11], [12, 9, 7, 1, 8], [12, 9, 1, 4, 8], [12, 7, 1, 4, 8],
148
+ [12, 9, 7, 11, 8], [12, 9, 4, 11, 8], [12, 7, 4, 11, 8], [12, 10, 2, 4, 3], [12, 1, 2, 4, 3],
149
+ [12, 10, 2, 5, 3], [12, 1, 2, 5, 3], [12, 10, 4, 5, 3], [12, 1, 4, 5, 3]]],
150
+ 'BCdlOG_base': [
151
+ [(-1, 0, 0),
152
+ (0, -1, 0),
153
+ (0, 0, -1),
154
+ (0, 0, 1),
155
+ (0, 1, 2),
156
+ (0, 1, 3),
157
+ (1, 0, 4)],
158
+ [[0, 4, 2], [0, 4, 5], [0, 5, 3], [0, 1, 3], [0, 1, 2],
159
+ [6, 4, 2], [6, 4, 5], [6, 5, 3], [6, 1, 3], [6, 1, 2]]],
160
+ 'P2_112': [
161
+ [(1, 0), (0, 1), (-1, -2)],
162
+ [[0, 1], [1, 2], [2, 0]]],
163
+ 'P2_123': [
164
+ [(1, 0), (0, 1), (-2, -3)],
165
+ [[0, 1], [1, 2], [2, 0]]],
166
+ 'P4_11169': [
167
+ [(1, 0, 0, 0), (0, 1, 0, 0), (0, 0, 1, 0), (0, 0, 0, 1), (-9, -6, -1, -1)],
168
+ [[0, 1, 2, 3], [0, 1, 2, 4], [0, 1, 3, 4], [0, 2, 3, 4], [1, 2, 3, 4]]],
169
+ 'P4_11169_resolved': [
170
+ [(1, 0, 0, 0), (0, 1, 0, 0), (0, 0, 1, 0), (0, 0, 0, 1), (-9, -6, -1, -1), (-3, -2, 0, 0)],
171
+ [[0, 1, 2, 3], [0, 1, 3, 4], [0, 1, 2, 4], [1, 3, 4, 5], [0, 3, 4, 5],
172
+ [1, 2, 4, 5], [0, 2, 4, 5], [1, 2, 3, 5], [0, 2, 3, 5]]],
173
+ 'P4_11133': [
174
+ [(1, 0, 0, 0), (0, 1, 0, 0), (0, 0, 1, 0), (0, 0, 0, 1), (-3, -3, -1, -1)],
175
+ [[0, 1, 2, 3], [0, 1, 2, 4], [0, 1, 3, 4], [0, 2, 3, 4], [1, 2, 3, 4]]],
176
+ 'P4_11133_resolved': [
177
+ [(1, 0, 0, 0), (0, 1, 0, 0), (0, 0, 1, 0), (0, 0, 0, 1), (-3, -3, -1, -1), (-1, -1, 0, 0)],
178
+ [[0, 1, 2, 3], [0, 1, 3, 4], [0, 1, 2, 4], [1, 3, 4, 5], [0, 3, 4, 5],
179
+ [1, 2, 4, 5], [0, 2, 4, 5], [1, 2, 3, 5], [0, 2, 3, 5]]]
180
+ }
181
+
182
+
183
+ class ToricVarietyFactory(SageObject):
184
+ r"""
185
+ The methods of this class construct toric varieties.
186
+
187
+ .. WARNING::
188
+
189
+ You need not create instances of this class. Use the
190
+ already-provided object ``toric_varieties`` instead.
191
+ """
192
+
193
+ _check = True
194
+
195
+ def _make_ToricVariety(self, name, coordinate_names, base_ring):
196
+ r"""
197
+ Construct a toric variety and cache the result.
198
+
199
+ INPUT:
200
+
201
+ - ``name`` -- string; one of the pre-defined names in the
202
+ ``toric_varieties_rays_cones`` data structure
203
+
204
+ - ``coordinate_names`` -- string describing the names of the
205
+ homogeneous coordinates of the toric variety
206
+
207
+ - ``base_ring`` -- a ring (default: `\QQ`); the base ring for
208
+ the toric variety
209
+
210
+ OUTPUT: a :class:`toric variety
211
+ <sage.schemes.toric.variety.ToricVariety_field>`.
212
+
213
+ EXAMPLES::
214
+
215
+ sage: toric_varieties.A1() # indirect doctest
216
+ 1-d affine toric variety
217
+ """
218
+ rays, cones = toric_varieties_rays_cones[name]
219
+ if coordinate_names is None:
220
+ dict_key = (name, base_ring)
221
+ else:
222
+ coordinate_names = normalize_names(coordinate_names, len(rays),
223
+ DEFAULT_PREFIX)
224
+ dict_key = (name, base_ring) + tuple(coordinate_names)
225
+ if dict_key not in self.__dict__:
226
+ fan = Fan(cones, rays, check=self._check)
227
+ self.__dict__[dict_key] = \
228
+ ToricVariety(fan,
229
+ coordinate_names=coordinate_names,
230
+ base_ring=base_ring)
231
+ return self.__dict__[dict_key]
232
+
233
+ def _make_CPRFanoToricVariety(self, name, coordinate_names, base_ring):
234
+ r"""
235
+ Construct a (crepant partially resolved) Fano toric variety
236
+ and cache the result.
237
+
238
+ INPUT:
239
+
240
+ - ``name`` -- string; one of the pre-defined names in the
241
+ ``toric_varieties_rays_cones`` data structure
242
+
243
+ - ``coordinate_names`` -- string describing the names of the
244
+ homogeneous coordinates of the toric variety
245
+
246
+ - ``base_ring`` -- a ring (default: `\QQ`); the base ring for
247
+ the toric variety
248
+
249
+ OUTPUT: a :class:`CPR-Fano toric variety
250
+ <sage.schemes.toric.fano_variety.CPRFanoToricVariety_field>`.
251
+
252
+ EXAMPLES::
253
+
254
+ sage: toric_varieties.P2() # indirect doctest
255
+ 2-d CPR-Fano toric variety covered by 3 affine patches
256
+ """
257
+ rays, cones = toric_varieties_rays_cones[name]
258
+ if coordinate_names is None:
259
+ dict_key = (name, base_ring)
260
+ else:
261
+ coordinate_names = normalize_names(coordinate_names, len(rays),
262
+ DEFAULT_PREFIX)
263
+ dict_key = (name, base_ring) + tuple(coordinate_names)
264
+ if dict_key not in self.__dict__:
265
+ polytope = LatticePolytope(rays, lattice=ToricLattice(len(rays[0])))
266
+ points = [tuple(_) for _ in polytope.points()]
267
+ ray2point = [points.index(r) for r in rays]
268
+ charts = [[ray2point[i] for i in c] for c in cones]
269
+ self.__dict__[dict_key] = \
270
+ CPRFanoToricVariety(Delta_polar=polytope,
271
+ coordinate_points=ray2point,
272
+ charts=charts,
273
+ coordinate_names=coordinate_names,
274
+ base_ring=base_ring,
275
+ check=self._check)
276
+ return self.__dict__[dict_key]
277
+
278
+ def dP6(self, names='x u y v z w', base_ring=QQ):
279
+ r"""
280
+ Construct the del Pezzo surface of degree 6 (`\mathbb{P}^2`
281
+ blown up at 3 points) as a toric variety.
282
+
283
+ INPUT:
284
+
285
+ - ``names`` -- string; names for the homogeneous coordinates. See
286
+ :func:`~sage.schemes.toric.variety.normalize_names` for acceptable
287
+ formats.
288
+
289
+ - ``base_ring`` -- a ring (default: `\QQ`); the base ring for
290
+ the toric variety
291
+
292
+ OUTPUT: a :class:`CPR-Fano toric variety
293
+ <sage.schemes.toric.fano_variety.CPRFanoToricVariety_field>`.
294
+
295
+ EXAMPLES::
296
+
297
+ sage: dP6 = toric_varieties.dP6(); dP6
298
+ 2-d CPR-Fano toric variety covered by 6 affine patches
299
+ sage: dP6.fan().rays()
300
+ N( 0, 1), N(-1, 0), N(-1, -1),
301
+ N( 0, -1), N( 1, 0), N( 1, 1)
302
+ in 2-d lattice N
303
+ sage: dP6.gens()
304
+ (x, u, y, v, z, w)
305
+ """
306
+ return self._make_CPRFanoToricVariety('dP6', names, base_ring)
307
+
308
+ def dP7(self, names='x u y v z', base_ring=QQ):
309
+ r"""
310
+ Construct the del Pezzo surface of degree 7 (`\mathbb{P}^2`
311
+ blown up at 2 points) as a toric variety.
312
+
313
+ INPUT:
314
+
315
+ - ``names`` -- string; names for the homogeneous coordinates. See
316
+ :func:`~sage.schemes.toric.variety.normalize_names` for acceptable
317
+ formats.
318
+
319
+ - ``base_ring`` -- a ring (default: `\QQ`); the base ring for
320
+ the toric variety
321
+
322
+ OUTPUT: a :class:`CPR-Fano toric variety
323
+ <sage.schemes.toric.fano_variety.CPRFanoToricVariety_field>`.
324
+
325
+ EXAMPLES::
326
+
327
+ sage: dP7 = toric_varieties.dP7(); dP7
328
+ 2-d CPR-Fano toric variety covered by 5 affine patches
329
+ sage: dP7.fan().rays()
330
+ N( 0, 1), N(-1, 0), N(-1, -1),
331
+ N( 0, -1), N( 1, 0)
332
+ in 2-d lattice N
333
+ sage: dP7.gens()
334
+ (x, u, y, v, z)
335
+ """
336
+ return self._make_CPRFanoToricVariety('dP7', names, base_ring)
337
+
338
+ def dP8(self, names='t x y z', base_ring=QQ):
339
+ r"""
340
+ Construct the del Pezzo surface of degree 8 (`\mathbb{P}^2`
341
+ blown up at 1 point) as a toric variety.
342
+
343
+ INPUT:
344
+
345
+ - ``names`` -- string; names for the homogeneous coordinates. See
346
+ :func:`~sage.schemes.toric.variety.normalize_names` for acceptable
347
+ formats.
348
+
349
+ - ``base_ring`` -- a ring (default: `\QQ`); the base ring for
350
+ the toric variety
351
+
352
+ OUTPUT: a :class:`CPR-Fano toric variety
353
+ <sage.schemes.toric.fano_variety.CPRFanoToricVariety_field>`.
354
+
355
+ EXAMPLES::
356
+
357
+ sage: dP8 = toric_varieties.dP8(); dP8
358
+ 2-d CPR-Fano toric variety covered by 4 affine patches
359
+ sage: dP8.fan().rays()
360
+ N( 1, 1), N( 0, 1),
361
+ N(-1, -1), N( 1, 0)
362
+ in 2-d lattice N
363
+ sage: dP8.gens()
364
+ (t, x, y, z)
365
+ """
366
+ return self._make_CPRFanoToricVariety('dP8', names, base_ring)
367
+
368
+ def P1xP1(self, names='s t x y', base_ring=QQ):
369
+ r"""
370
+ Construct the del Pezzo surface `\mathbb{P}^1 \times
371
+ \mathbb{P}^1` as a toric variety.
372
+
373
+ INPUT:
374
+
375
+ - ``names`` -- string; names for the homogeneous coordinates. See
376
+ :func:`~sage.schemes.toric.variety.normalize_names` for acceptable
377
+ formats.
378
+
379
+ - ``base_ring`` -- a ring (default: `\QQ`); the base ring for
380
+ the toric variety
381
+
382
+ OUTPUT: a :class:`CPR-Fano toric variety
383
+ <sage.schemes.toric.fano_variety.CPRFanoToricVariety_field>`.
384
+
385
+ EXAMPLES::
386
+
387
+ sage: P1xP1 = toric_varieties.P1xP1(); P1xP1
388
+ 2-d CPR-Fano toric variety covered by 4 affine patches
389
+ sage: P1xP1.fan().rays()
390
+ N( 1, 0), N(-1, 0),
391
+ N( 0, 1), N( 0, -1)
392
+ in 2-d lattice N
393
+ sage: P1xP1.gens()
394
+ (s, t, x, y)
395
+ """
396
+ return self._make_CPRFanoToricVariety('P1xP1', names, base_ring)
397
+
398
+ def P1xP1_Z2(self, names='s t x y', base_ring=QQ):
399
+ r"""
400
+ Construct the toric `\ZZ_2`-orbifold of the del Pezzo
401
+ surface `\mathbb{P}^1 \times \mathbb{P}^1` as a toric variety.
402
+
403
+ INPUT:
404
+
405
+ - ``names`` -- string; names for the homogeneous coordinates. See
406
+ :func:`~sage.schemes.toric.variety.normalize_names` for acceptable
407
+ formats.
408
+
409
+ - ``base_ring`` -- a ring (default: `\QQ`); the base ring for
410
+ the toric variety
411
+
412
+ OUTPUT: a :class:`CPR-Fano toric variety
413
+ <sage.schemes.toric.fano_variety.CPRFanoToricVariety_field>`.
414
+
415
+ EXAMPLES::
416
+
417
+ sage: P1xP1_Z2 = toric_varieties.P1xP1_Z2(); P1xP1_Z2
418
+ 2-d CPR-Fano toric variety covered by 4 affine patches
419
+ sage: P1xP1_Z2.fan().rays()
420
+ N( 1, 1), N(-1, -1),
421
+ N(-1, 1), N( 1, -1)
422
+ in 2-d lattice N
423
+ sage: P1xP1_Z2.gens()
424
+ (s, t, x, y)
425
+ sage: P1xP1_Z2.Chow_group().degree(1)
426
+ C2 x Z^2
427
+ """
428
+ return self._make_CPRFanoToricVariety('P1xP1_Z2', names, base_ring)
429
+
430
+ def P1(self, names='s t', base_ring=QQ):
431
+ r"""
432
+ Construct the projective line `\mathbb{P}^1` as a toric
433
+ variety.
434
+
435
+ INPUT:
436
+
437
+ - ``names`` -- string; names for the homogeneous coordinates. See
438
+ :func:`~sage.schemes.toric.variety.normalize_names` for acceptable
439
+ formats.
440
+
441
+ - ``base_ring`` -- a ring (default: `\QQ`); the base ring for
442
+ the toric variety
443
+
444
+ OUTPUT: a :class:`CPR-Fano toric variety
445
+ <sage.schemes.toric.fano_variety.CPRFanoToricVariety_field>`.
446
+
447
+ EXAMPLES::
448
+
449
+ sage: P1 = toric_varieties.P1(); P1
450
+ 1-d CPR-Fano toric variety covered by 2 affine patches
451
+ sage: P1.fan().rays()
452
+ N( 1),
453
+ N(-1)
454
+ in 1-d lattice N
455
+ sage: P1.gens()
456
+ (s, t)
457
+ """
458
+ return self._make_CPRFanoToricVariety('P1', names, base_ring)
459
+
460
+ def P2(self, names='x y z', base_ring=QQ):
461
+ r"""
462
+ Construct the projective plane `\mathbb{P}^2` as a toric
463
+ variety.
464
+
465
+ INPUT:
466
+
467
+ - ``names`` -- string; names for the homogeneous coordinates. See
468
+ :func:`~sage.schemes.toric.variety.normalize_names` for acceptable
469
+ formats.
470
+
471
+ - ``base_ring`` -- a ring (default: `\QQ`); the base ring for
472
+ the toric variety
473
+
474
+ OUTPUT: a :class:`CPR-Fano toric variety
475
+ <sage.schemes.toric.fano_variety.CPRFanoToricVariety_field>`.
476
+
477
+ EXAMPLES::
478
+
479
+ sage: P2 = toric_varieties.P2(); P2
480
+ 2-d CPR-Fano toric variety covered by 3 affine patches
481
+ sage: P2.fan().rays()
482
+ N( 1, 0),
483
+ N( 0, 1),
484
+ N(-1, -1)
485
+ in 2-d lattice N
486
+ sage: P2.gens()
487
+ (x, y, z)
488
+ """
489
+ return self._make_CPRFanoToricVariety('P2', names, base_ring)
490
+
491
+ def P(self, n, names='z+', base_ring=QQ):
492
+ r"""
493
+ Construct the ``n``-dimensional projective space `\mathbb{P}^n`.
494
+
495
+ INPUT:
496
+
497
+ - ``n`` -- positive integer; the dimension of the projective space
498
+
499
+ - ``names`` -- string; names for the homogeneous coordinates. See
500
+ :func:`~sage.schemes.toric.variety.normalize_names` for acceptable
501
+ formats.
502
+
503
+ - ``base_ring`` -- a ring (default: `\QQ`); the base ring for
504
+ the toric variety
505
+
506
+ OUTPUT: a :class:`CPR-Fano toric variety
507
+ <sage.schemes.toric.fano_variety.CPRFanoToricVariety_field>`.
508
+
509
+ EXAMPLES::
510
+
511
+ sage: P3 = toric_varieties.P(3); P3
512
+ 3-d CPR-Fano toric variety covered by 4 affine patches
513
+ sage: P3.fan().rays()
514
+ N( 1, 0, 0),
515
+ N( 0, 1, 0),
516
+ N( 0, 0, 1),
517
+ N(-1, -1, -1)
518
+ in 3-d lattice N
519
+ sage: P3.gens()
520
+ (z0, z1, z2, z3)
521
+ """
522
+ # We are going to eventually switch off consistency checks, so we need
523
+ # to be sure that the input is acceptable.
524
+ try:
525
+ n = ZZ(n) # make sure that we got a "mathematical" integer
526
+ except TypeError:
527
+ raise TypeError("dimension of the projective space must be a "
528
+ "positive integer!\nGot: %s" % n)
529
+ if n <= 0:
530
+ raise ValueError("only projective spaces of positive dimension "
531
+ "can be constructed!\nGot: %s" % n)
532
+ m = identity_matrix(n).augment(matrix(n, 1, [-1] * n))
533
+ charts = [list(range(i)) + list(range(i + 1, n + 1))
534
+ for i in range(n + 1)]
535
+ return CPRFanoToricVariety(
536
+ Delta_polar=LatticePolytope(m.columns(), lattice=ToricLattice(n)),
537
+ charts=charts, check=self._check, coordinate_names=names,
538
+ base_ring=base_ring)
539
+
540
+ def A1(self, names='z', base_ring=QQ):
541
+ r"""
542
+ Construct the affine line `\mathbb{A}^1` as a toric variety.
543
+
544
+ INPUT:
545
+
546
+ - ``names`` -- string; names for the homogeneous coordinates. See
547
+ :func:`~sage.schemes.toric.variety.normalize_names` for acceptable
548
+ formats.
549
+
550
+ - ``base_ring`` -- a ring (default: `\QQ`); the base ring for
551
+ the toric variety
552
+
553
+ OUTPUT: a :class:`toric variety
554
+ <sage.schemes.toric.variety.ToricVariety_field>`.
555
+
556
+ EXAMPLES::
557
+
558
+ sage: A1 = toric_varieties.A1(); A1
559
+ 1-d affine toric variety
560
+ sage: A1.fan().rays()
561
+ N(1)
562
+ in 1-d lattice N
563
+ sage: A1.gens()
564
+ (z,)
565
+ """
566
+ return self._make_ToricVariety('A1', names, base_ring)
567
+
568
+ def A2(self, names='x y', base_ring=QQ):
569
+ r"""
570
+ Construct the affine plane `\mathbb{A}^2` as a toric variety.
571
+
572
+ INPUT:
573
+
574
+ - ``names`` -- string; names for the homogeneous coordinates. See
575
+ :func:`~sage.schemes.toric.variety.normalize_names` for acceptable
576
+ formats.
577
+
578
+ - ``base_ring`` -- a ring (default: `\QQ`); the base ring for
579
+ the toric variety
580
+
581
+ OUTPUT: a :class:`toric variety
582
+ <sage.schemes.toric.variety.ToricVariety_field>`.
583
+
584
+ EXAMPLES::
585
+
586
+ sage: A2 = toric_varieties.A2(); A2
587
+ 2-d affine toric variety
588
+ sage: A2.fan().rays()
589
+ N(1, 0),
590
+ N(0, 1)
591
+ in 2-d lattice N
592
+ sage: A2.gens()
593
+ (x, y)
594
+ """
595
+ return self._make_ToricVariety('A2', names, base_ring)
596
+
597
+ def A(self, n, names='z+', base_ring=QQ):
598
+ r"""
599
+ Construct the ``n``-dimensional affine space.
600
+
601
+ INPUT:
602
+
603
+ - ``n`` -- positive integer; the dimension of the affine space
604
+
605
+ - ``names`` -- string; names for the homogeneous coordinates. See
606
+ :func:`~sage.schemes.toric.variety.normalize_names` for acceptable
607
+ formats.
608
+
609
+ - ``base_ring`` -- a ring (default: `\QQ`); the base ring for
610
+ the toric variety
611
+
612
+ OUTPUT: a :class:`toric variety
613
+ <sage.schemes.toric.variety.ToricVariety_field>`.
614
+
615
+ EXAMPLES::
616
+
617
+ sage: A3 = toric_varieties.A(3); A3
618
+ 3-d affine toric variety
619
+ sage: A3.fan().rays()
620
+ N(1, 0, 0),
621
+ N(0, 1, 0),
622
+ N(0, 0, 1)
623
+ in 3-d lattice N
624
+ sage: A3.gens()
625
+ (z0, z1, z2)
626
+ """
627
+ # We are going to eventually switch off consistency checks, so we need
628
+ # to be sure that the input is acceptable.
629
+ try:
630
+ n = ZZ(n) # make sure that we got a "mathematical" integer
631
+ except TypeError:
632
+ raise TypeError("dimension of the affine space must be a "
633
+ "positive integer!\nGot: %s" % n)
634
+ if n <= 0:
635
+ raise ValueError("only affine spaces of positive dimension can "
636
+ "be constructed!\nGot: %s" % n)
637
+ rays = identity_matrix(n).columns()
638
+ cones = [list(range(n))]
639
+ fan = Fan(cones, rays, check=self._check)
640
+ return ToricVariety(fan, coordinate_names=names)
641
+
642
+ def A2_Z2(self, names='x y', base_ring=QQ):
643
+ r"""
644
+ Construct the orbifold `\mathbb{A}^2 / \ZZ_2` as a toric
645
+ variety.
646
+
647
+ INPUT:
648
+
649
+ - ``names`` -- string; names for the homogeneous coordinates. See
650
+ :func:`~sage.schemes.toric.variety.normalize_names` for acceptable
651
+ formats.
652
+
653
+ - ``base_ring`` -- a ring (default: `\QQ`); the base ring for
654
+ the toric variety
655
+
656
+ OUTPUT: a :class:`toric variety
657
+ <sage.schemes.toric.variety.ToricVariety_field>`.
658
+
659
+ EXAMPLES::
660
+
661
+ sage: A2_Z2 = toric_varieties.A2_Z2(); A2_Z2
662
+ 2-d affine toric variety
663
+ sage: A2_Z2.fan().rays()
664
+ N(1, 0),
665
+ N(1, 2)
666
+ in 2-d lattice N
667
+ sage: A2_Z2.gens()
668
+ (x, y)
669
+ """
670
+ return self._make_ToricVariety('A2_Z2', names, base_ring)
671
+
672
+ def P1xA1(self, names='s t z', base_ring=QQ):
673
+ r"""
674
+ Construct the Cartesian product `\mathbb{P}^1 \times \mathbb{A}^1` as
675
+ a toric variety.
676
+
677
+ INPUT:
678
+
679
+ - ``names`` -- string; names for the homogeneous coordinates. See
680
+ :func:`~sage.schemes.toric.variety.normalize_names` for acceptable
681
+ formats.
682
+
683
+ - ``base_ring`` -- a ring (default: `\QQ`); the base ring for
684
+ the toric variety
685
+
686
+ OUTPUT: a :class:`toric variety
687
+ <sage.schemes.toric.variety.ToricVariety_field>`.
688
+
689
+ EXAMPLES::
690
+
691
+ sage: P1xA1 = toric_varieties.P1xA1(); P1xA1
692
+ 2-d toric variety covered by 2 affine patches
693
+ sage: P1xA1.fan().rays()
694
+ N( 1, 0),
695
+ N(-1, 0),
696
+ N( 0, 1)
697
+ in 2-d lattice N
698
+ sage: P1xA1.gens()
699
+ (s, t, z)
700
+ """
701
+ return self._make_ToricVariety('P1xA1', names, base_ring)
702
+
703
+ def Conifold(self, names='u x y v', base_ring=QQ):
704
+ r"""
705
+ Construct the conifold as a toric variety.
706
+
707
+ INPUT:
708
+
709
+ - ``names`` -- string; names for the homogeneous coordinates. See
710
+ :func:`~sage.schemes.toric.variety.normalize_names` for acceptable
711
+ formats.
712
+
713
+ - ``base_ring`` -- a ring (default: `\QQ`); the base ring for
714
+ the toric variety
715
+
716
+ OUTPUT: a :class:`toric variety
717
+ <sage.schemes.toric.variety.ToricVariety_field>`.
718
+
719
+ EXAMPLES::
720
+
721
+ sage: Conifold = toric_varieties.Conifold(); Conifold
722
+ 3-d affine toric variety
723
+ sage: Conifold.fan().rays()
724
+ N(0, 0, 1), N(0, 1, 1),
725
+ N(1, 0, 1), N(1, 1, 1)
726
+ in 3-d lattice N
727
+ sage: Conifold.gens()
728
+ (u, x, y, v)
729
+ """
730
+ return self._make_ToricVariety('Conifold', names, base_ring)
731
+
732
+ def dP6xdP6(self, names='x0 x1 x2 x3 x4 x5 y0 y1 y2 y3 y4 y5', base_ring=QQ):
733
+ r"""
734
+ Construct the product of two del Pezzo surfaces of degree 6
735
+ (`\mathbb{P}^2` blown up at 3 points) as a toric variety.
736
+
737
+ INPUT:
738
+
739
+ - ``names`` -- string; names for the homogeneous coordinates. See
740
+ :func:`~sage.schemes.toric.variety.normalize_names` for acceptable
741
+ formats.
742
+
743
+ - ``base_ring`` -- a ring (default: `\QQ`); the base ring for
744
+ the toric variety
745
+
746
+ OUTPUT: a :class:`CPR-Fano toric variety
747
+ <sage.schemes.toric.fano_variety.CPRFanoToricVariety_field>`.
748
+
749
+ EXAMPLES::
750
+
751
+ sage: dP6xdP6 = toric_varieties.dP6xdP6(); dP6xdP6
752
+ 4-d CPR-Fano toric variety covered by 36 affine patches
753
+ sage: dP6xdP6.fan().rays()
754
+ N( 0, 1, 0, 0), N(-1, 0, 0, 0), N(-1, -1, 0, 0),
755
+ N( 0, -1, 0, 0), N( 1, 0, 0, 0), N( 1, 1, 0, 0),
756
+ N( 0, 0, 0, 1), N( 0, 0, -1, 0), N( 0, 0, -1, -1),
757
+ N( 0, 0, 0, -1), N( 0, 0, 1, 0), N( 0, 0, 1, 1)
758
+ in 4-d lattice N
759
+ sage: dP6xdP6.gens()
760
+ (x0, x1, x2, x3, x4, x5, y0, y1, y2, y3, y4, y5)
761
+ """
762
+ return self._make_CPRFanoToricVariety('dP6xdP6', names, base_ring)
763
+
764
+ def Cube_face_fan(self, names='z+', base_ring=QQ):
765
+ r"""
766
+ Construct the toric variety given by the face fan of the
767
+ 3-dimensional unit lattice cube.
768
+
769
+ This variety has 6 conifold singularities but the fan is still
770
+ polyhedral.
771
+
772
+ INPUT:
773
+
774
+ - ``names`` -- string; names for the homogeneous coordinates. See
775
+ :func:`~sage.schemes.toric.variety.normalize_names` for acceptable
776
+ formats.
777
+
778
+ - ``base_ring`` -- a ring (default: `\QQ`); the base ring for
779
+ the toric variety
780
+
781
+ OUTPUT: a :class:`CPR-Fano toric variety
782
+ <sage.schemes.toric.fano_variety.CPRFanoToricVariety_field>`.
783
+
784
+ EXAMPLES::
785
+
786
+ sage: Cube_face_fan = toric_varieties.Cube_face_fan(); Cube_face_fan
787
+ 3-d CPR-Fano toric variety covered by 6 affine patches
788
+ sage: Cube_face_fan.fan().rays()
789
+ N( 1, 1, 1), N( 1, -1, 1), N(-1, 1, 1), N(-1, -1, 1),
790
+ N(-1, -1, -1), N(-1, 1, -1), N( 1, -1, -1), N( 1, 1, -1)
791
+ in 3-d lattice N
792
+ sage: Cube_face_fan.gens()
793
+ (z0, z1, z2, z3, z4, z5, z6, z7)
794
+ """
795
+ return self._make_CPRFanoToricVariety('Cube_face_fan', names, base_ring)
796
+
797
+ def Cube_sublattice(self, names='z+', base_ring=QQ):
798
+ r"""
799
+ Construct the toric variety defined by a face fan over a
800
+ 3-dimensional cube, but not the unit cube in the
801
+ N-lattice. See p. 65 of [Ful1993]_.
802
+
803
+ Its Chow group is `A_2(X)=\ZZ^5`, which distinguishes
804
+ it from the face fan of the unit cube.
805
+
806
+ INPUT:
807
+
808
+ - ``names`` -- string; names for the homogeneous coordinates. See
809
+ :func:`~sage.schemes.toric.variety.normalize_names` for acceptable
810
+ formats.
811
+
812
+ - ``base_ring`` -- a ring (default: `\QQ`); the base ring for
813
+ the toric variety
814
+
815
+ OUTPUT: a :class:`CPR-Fano toric variety
816
+ <sage.schemes.toric.fano_variety.CPRFanoToricVariety_field>`.
817
+
818
+ EXAMPLES::
819
+
820
+ sage: Cube_sublattice = toric_varieties.Cube_sublattice(); Cube_sublattice
821
+ 3-d CPR-Fano toric variety covered by 6 affine patches
822
+ sage: Cube_sublattice.fan().rays()
823
+ N( 1, 0, 0), N( 0, 1, 0), N( 0, 0, 1), N(-1, 1, 1),
824
+ N(-1, 0, 0), N( 0, -1, 0), N( 0, 0, -1), N( 1, -1, -1)
825
+ in 3-d lattice N
826
+ sage: Cube_sublattice.gens()
827
+ (z0, z1, z2, z3, z4, z5, z6, z7)
828
+ """
829
+ return self._make_CPRFanoToricVariety('Cube_sublattice', names, base_ring)
830
+
831
+ def Cube_nonpolyhedral(self, names='z+', base_ring=QQ):
832
+ r"""
833
+ Construct the toric variety defined by a fan that is not the
834
+ face fan of a polyhedron.
835
+
836
+ This toric variety is defined by a fan that is topologically
837
+ like the face fan of a 3-dimensional cube, but with a
838
+ different N-lattice structure.
839
+
840
+ INPUT:
841
+
842
+ - ``names`` -- string; names for the homogeneous coordinates. See
843
+ :func:`~sage.schemes.toric.variety.normalize_names` for acceptable
844
+ formats.
845
+
846
+ - ``base_ring`` -- a ring (default: `\QQ`); the base ring for
847
+ the toric variety
848
+
849
+ OUTPUT: a :class:`toric variety
850
+ <sage.schemes.toric.variety.ToricVariety_field>`.
851
+
852
+ .. NOTE::
853
+
854
+ * This is an example of a non-polyhedral fan.
855
+
856
+ * Its Chow group has torsion: `A_2(X)=\ZZ^5 \oplus \ZZ_2`
857
+
858
+ EXAMPLES::
859
+
860
+ sage: Cube_nonpolyhedral = toric_varieties.Cube_nonpolyhedral()
861
+ sage: Cube_nonpolyhedral
862
+ 3-d toric variety covered by 6 affine patches
863
+ sage: Cube_nonpolyhedral.fan().rays()
864
+ N( 1, 2, 3), N( 1, -1, 1), N(-1, 1, 1), N(-1, -1, 1),
865
+ N(-1, -1, -1), N(-1, 1, -1), N( 1, -1, -1), N( 1, 1, -1)
866
+ in 3-d lattice N
867
+ sage: Cube_nonpolyhedral.gens()
868
+ (z0, z1, z2, z3, z4, z5, z6, z7)
869
+ """
870
+ return self._make_ToricVariety('Cube_nonpolyhedral', names, base_ring)
871
+
872
+ def Cube_deformation(self, k, names=None, base_ring=QQ):
873
+ r"""
874
+ Construct, for each `k\in\ZZ_{\geq 0}`, a toric variety with
875
+ `\ZZ_k`-torsion in the Chow group.
876
+
877
+ The fans of this sequence of toric varieties all equal the
878
+ face fan of a unit cube topologically, but the
879
+ ``(1,1,1)``-vertex is moved to ``(1,1,2k+1)``. This example
880
+ was studied in [FS1994]_.
881
+
882
+ INPUT:
883
+
884
+ - ``k`` -- integer; the case ``k=0`` is the same as
885
+ :meth:`Cube_face_fan`
886
+
887
+ - ``names`` -- string; names for the homogeneous coordinates. See
888
+ :func:`~sage.schemes.toric.variety.normalize_names` for acceptable
889
+ formats.
890
+
891
+ - ``base_ring`` -- a ring (default: `\QQ`); the base ring for
892
+ the toric variety
893
+
894
+ OUTPUT:
895
+
896
+ A :class:`toric variety
897
+ <sage.schemes.toric.variety.ToricVariety_field>`
898
+ `X_k`. Its Chow group is `A_1(X_k)=\ZZ_k`.
899
+
900
+ EXAMPLES::
901
+
902
+ sage: X_2 = toric_varieties.Cube_deformation(2); X_2
903
+ 3-d toric variety covered by 6 affine patches
904
+ sage: X_2.fan().rays()
905
+ N( 1, 1, 5), N( 1, -1, 1), N(-1, 1, 1), N(-1, -1, 1),
906
+ N(-1, -1, -1), N(-1, 1, -1), N( 1, -1, -1), N( 1, 1, -1)
907
+ in 3-d lattice N
908
+ sage: X_2.gens()
909
+ (z0, z1, z2, z3, z4, z5, z6, z7)
910
+ """
911
+ # We are going to eventually switch off consistency checks, so we need
912
+ # to be sure that the input is acceptable.
913
+ try:
914
+ k = ZZ(k) # make sure that we got a "mathematical" integer
915
+ except TypeError:
916
+ raise TypeError("cube deformations X_k are defined only for "
917
+ "nonnegative integer k!\nGot: %s" % k)
918
+ if k < 0:
919
+ raise ValueError("cube deformations X_k are defined only for "
920
+ "nonnegative k!\nGot: %s" % k)
921
+
922
+ def rays(kappa):
923
+ return matrix([[1, 1, 2 * kappa + 1], [1, -1, 1],
924
+ [-1, 1, 1], [-1, -1, 1],
925
+ [-1, -1, -1], [-1, 1, -1],
926
+ [1, -1, -1], [1, 1, -1]])
927
+
928
+ cones = [[0, 1, 2, 3], [4, 5, 6, 7], [0, 1, 7, 6],
929
+ [4, 5, 3, 2], [0, 2, 5, 7], [4, 6, 1, 3]]
930
+ fan = Fan(cones, rays(k))
931
+ return ToricVariety(fan, coordinate_names=names)
932
+
933
+ def BCdlOG(self, names='v1 v2 c1 c2 v4 v5 b e1 e2 e3 f g v6', base_ring=QQ):
934
+ r"""
935
+ Construct the 5-dimensional toric variety studied in
936
+ [BCdlOG2000]_, [HLY2002]_
937
+
938
+ INPUT:
939
+
940
+ - ``names`` -- string; names for the homogeneous coordinates. See
941
+ :func:`~sage.schemes.toric.variety.normalize_names` for acceptable
942
+ formats.
943
+
944
+ - ``base_ring`` -- a ring (default: `\QQ`); the base ring for
945
+ the toric variety
946
+
947
+ OUTPUT: a :class:`CPR-Fano toric variety
948
+ <sage.schemes.toric.fano_variety.CPRFanoToricVariety_field>`.
949
+
950
+ EXAMPLES::
951
+
952
+ sage: X = toric_varieties.BCdlOG(); X
953
+ 5-d CPR-Fano toric variety covered by 54 affine patches
954
+ sage: X.fan().rays()
955
+ N(-1, 0, 0, 2, 3), N( 0, -1, 0, 2, 3),
956
+ N( 0, 0, -1, 2, 3), N( 0, 0, -1, 1, 2),
957
+ N( 0, 0, 0, -1, 0), N( 0, 0, 0, 0, -1),
958
+ N( 0, 0, 0, 2, 3), N( 0, 0, 1, 2, 3),
959
+ N( 0, 0, 2, 2, 3), N( 0, 0, 1, 1, 1),
960
+ N( 0, 1, 2, 2, 3), N( 0, 1, 3, 2, 3),
961
+ N( 1, 0, 4, 2, 3)
962
+ in 5-d lattice N
963
+ sage: X.gens()
964
+ (v1, v2, c1, c2, v4, v5, b, e1, e2, e3, f, g, v6)
965
+ """
966
+ return self._make_CPRFanoToricVariety('BCdlOG', names, base_ring)
967
+
968
+ def BCdlOG_base(self, names='d4 d3 r2 r1 d2 u d1', base_ring=QQ):
969
+ r"""
970
+ Construct the base of the `\mathbb{P}^2(1,2,3)` fibration
971
+ :meth:`BCdlOG`.
972
+
973
+ INPUT:
974
+
975
+ - ``names`` -- string; names for the homogeneous coordinates. See
976
+ :func:`~sage.schemes.toric.variety.normalize_names` for acceptable
977
+ formats.
978
+
979
+ - ``base_ring`` -- a ring (default: `\QQ`); the base ring for
980
+ the toric variety
981
+
982
+ OUTPUT: a :class:`toric variety
983
+ <sage.schemes.toric.variety.ToricVariety_field>`.
984
+
985
+ EXAMPLES::
986
+
987
+ sage: base = toric_varieties.BCdlOG_base(); base
988
+ 3-d toric variety covered by 10 affine patches
989
+ sage: base.fan().rays()
990
+ N(-1, 0, 0), N( 0, -1, 0), N( 0, 0, -1), N( 0, 0, 1),
991
+ N( 0, 1, 2), N( 0, 1, 3), N( 1, 0, 4)
992
+ in 3-d lattice N
993
+ sage: base.gens()
994
+ (d4, d3, r2, r1, d2, u, d1)
995
+ """
996
+ return self._make_ToricVariety('BCdlOG_base', names, base_ring)
997
+
998
+ def P2_112(self, names='z+', base_ring=QQ):
999
+ r"""
1000
+ Construct the weighted projective space
1001
+ `\mathbb{P}^2(1,1,2)`.
1002
+
1003
+ INPUT:
1004
+
1005
+ - ``names`` -- string; names for the homogeneous coordinates. See
1006
+ :func:`~sage.schemes.toric.variety.normalize_names` for acceptable
1007
+ formats.
1008
+
1009
+ - ``base_ring`` -- a ring (default: `\QQ`); the base ring for
1010
+ the toric variety
1011
+
1012
+ OUTPUT: a :class:`CPR-Fano toric variety
1013
+ <sage.schemes.toric.fano_variety.CPRFanoToricVariety_field>`.
1014
+
1015
+ EXAMPLES::
1016
+
1017
+ sage: P2_112 = toric_varieties.P2_112(); P2_112
1018
+ 2-d CPR-Fano toric variety covered by 3 affine patches
1019
+ sage: P2_112.fan().rays()
1020
+ N( 1, 0),
1021
+ N( 0, 1),
1022
+ N(-1, -2)
1023
+ in 2-d lattice N
1024
+ sage: P2_112.gens()
1025
+ (z0, z1, z2)
1026
+ """
1027
+ return self._make_CPRFanoToricVariety('P2_112', names, base_ring)
1028
+
1029
+ def P2_123(self, names='z+', base_ring=QQ):
1030
+ r"""
1031
+ Construct the weighted projective space
1032
+ `\mathbb{P}^2(1,2,3)`.
1033
+
1034
+ INPUT:
1035
+
1036
+ - ``names`` -- string; names for the homogeneous coordinates. See
1037
+ :func:`~sage.schemes.toric.variety.normalize_names` for acceptable
1038
+ formats.
1039
+
1040
+ - ``base_ring`` -- a ring (default: `\QQ`); the base ring for
1041
+ the toric variety
1042
+
1043
+ OUTPUT: a :class:`CPR-Fano toric variety
1044
+ <sage.schemes.toric.fano_variety.CPRFanoToricVariety_field>`.
1045
+
1046
+ EXAMPLES::
1047
+
1048
+ sage: P2_123 = toric_varieties.P2_123(); P2_123
1049
+ 2-d CPR-Fano toric variety covered by 3 affine patches
1050
+ sage: P2_123.fan().rays()
1051
+ N( 1, 0),
1052
+ N( 0, 1),
1053
+ N(-2, -3)
1054
+ in 2-d lattice N
1055
+ sage: P2_123.gens()
1056
+ (z0, z1, z2)
1057
+ """
1058
+ return self._make_CPRFanoToricVariety('P2_123', names, base_ring)
1059
+
1060
+ def P4_11169(self, names='z+', base_ring=QQ):
1061
+ r"""
1062
+ Construct the weighted projective space
1063
+ `\mathbb{P}^4(1,1,1,6,9)`.
1064
+
1065
+ INPUT:
1066
+
1067
+ - ``names`` -- string; names for the homogeneous coordinates. See
1068
+ :func:`~sage.schemes.toric.variety.normalize_names` for acceptable
1069
+ formats.
1070
+
1071
+ - ``base_ring`` -- a ring (default: `\QQ`); the base ring for
1072
+ the toric variety
1073
+
1074
+ OUTPUT: a :class:`CPR-Fano toric variety
1075
+ <sage.schemes.toric.fano_variety.CPRFanoToricVariety_field>`.
1076
+
1077
+ EXAMPLES::
1078
+
1079
+ sage: P4_11169 = toric_varieties.P4_11169(); P4_11169
1080
+ 4-d CPR-Fano toric variety covered by 5 affine patches
1081
+ sage: P4_11169.fan().rays()
1082
+ N( 1, 0, 0, 0), N( 0, 1, 0, 0), N( 0, 0, 1, 0),
1083
+ N( 0, 0, 0, 1), N(-9, -6, -1, -1)
1084
+ in 4-d lattice N
1085
+ sage: P4_11169.gens()
1086
+ (z0, z1, z2, z3, z4)
1087
+ """
1088
+ return self._make_CPRFanoToricVariety('P4_11169', names, base_ring)
1089
+
1090
+ def P4_11169_resolved(self, names='z+', base_ring=QQ):
1091
+ r"""
1092
+ Construct the blow-up of the weighted projective space
1093
+ `\mathbb{P}^4(1,1,1,6,9)` at its curve of `\ZZ_3` orbifold
1094
+ fixed points.
1095
+
1096
+ INPUT:
1097
+
1098
+ - ``names`` -- string; names for the homogeneous coordinates. See
1099
+ :func:`~sage.schemes.toric.variety.normalize_names` for acceptable
1100
+ formats.
1101
+
1102
+ - ``base_ring`` -- a ring (default: `\QQ`); the base ring for
1103
+ the toric variety
1104
+
1105
+ OUTPUT: a :class:`CPR-Fano toric variety
1106
+ <sage.schemes.toric.fano_variety.CPRFanoToricVariety_field>`.
1107
+
1108
+ EXAMPLES::
1109
+
1110
+ sage: P4_11169_resolved = toric_varieties.P4_11169_resolved()
1111
+ sage: P4_11169_resolved
1112
+ 4-d CPR-Fano toric variety covered by 9 affine patches
1113
+ sage: P4_11169_resolved.fan().rays()
1114
+ N( 1, 0, 0, 0), N( 0, 1, 0, 0), N( 0, 0, 1, 0),
1115
+ N( 0, 0, 0, 1), N(-9, -6, -1, -1), N(-3, -2, 0, 0)
1116
+ in 4-d lattice N
1117
+ sage: P4_11169_resolved.gens()
1118
+ (z0, z1, z2, z3, z4, z5)
1119
+ """
1120
+ return self._make_CPRFanoToricVariety('P4_11169_resolved', names, base_ring)
1121
+
1122
+ def P4_11133(self, names='z+', base_ring=QQ):
1123
+ r"""
1124
+ Construct the weighted projective space
1125
+ `\mathbb{P}^4(1,1,1,3,3)`.
1126
+
1127
+ INPUT:
1128
+
1129
+ - ``names`` -- string; names for the homogeneous coordinates. See
1130
+ :func:`~sage.schemes.toric.variety.normalize_names` for acceptable
1131
+ formats.
1132
+
1133
+ - ``base_ring`` -- a ring (default: `\QQ`); the base ring for
1134
+ the toric variety
1135
+
1136
+ OUTPUT: a :class:`CPR-Fano toric variety
1137
+ <sage.schemes.toric.fano_variety.CPRFanoToricVariety_field>`.
1138
+
1139
+ EXAMPLES::
1140
+
1141
+ sage: P4_11133 = toric_varieties.P4_11133(); P4_11133
1142
+ 4-d CPR-Fano toric variety covered by 5 affine patches
1143
+ sage: P4_11133.fan().rays()
1144
+ N( 1, 0, 0, 0), N( 0, 1, 0, 0), N( 0, 0, 1, 0),
1145
+ N( 0, 0, 0, 1), N(-3, -3, -1, -1)
1146
+ in 4-d lattice N
1147
+ sage: P4_11133.gens()
1148
+ (z0, z1, z2, z3, z4)
1149
+ """
1150
+ return self._make_CPRFanoToricVariety('P4_11133', names, base_ring)
1151
+
1152
+ def P4_11133_resolved(self, names='z+', base_ring=QQ):
1153
+ r"""
1154
+ Construct the weighted projective space
1155
+ `\mathbb{P}^4(1,1,1,3,3)`.
1156
+
1157
+ INPUT:
1158
+
1159
+ - ``names`` -- string; names for the homogeneous coordinates. See
1160
+ :func:`~sage.schemes.toric.variety.normalize_names` for acceptable
1161
+ formats.
1162
+
1163
+ - ``base_ring`` -- a ring (default: `\QQ`); the base ring for
1164
+ the toric variety
1165
+
1166
+ OUTPUT: a :class:`CPR-Fano toric variety
1167
+ <sage.schemes.toric.fano_variety.CPRFanoToricVariety_field>`.
1168
+
1169
+ EXAMPLES::
1170
+
1171
+ sage: P4_11133_resolved = toric_varieties.P4_11133_resolved()
1172
+ sage: P4_11133_resolved
1173
+ 4-d CPR-Fano toric variety covered by 9 affine patches
1174
+ sage: P4_11133_resolved.fan().rays()
1175
+ N( 1, 0, 0, 0), N( 0, 1, 0, 0), N( 0, 0, 1, 0),
1176
+ N( 0, 0, 0, 1), N(-3, -3, -1, -1), N(-1, -1, 0, 0)
1177
+ in 4-d lattice N
1178
+ sage: P4_11133_resolved.gens()
1179
+ (z0, z1, z2, z3, z4, z5)
1180
+ """
1181
+ return self._make_CPRFanoToricVariety('P4_11133_resolved', names, base_ring)
1182
+
1183
+ def WP(self, *q, **kw):
1184
+ # Specific keyword arguments instead of **kw would be preferable,
1185
+ # later versions of Python might support specific (optional) keyword
1186
+ # arguments after *q.
1187
+ r"""
1188
+ Construct weighted projective `n`-space over a field.
1189
+
1190
+ INPUT:
1191
+
1192
+ - ``q`` -- a sequence of positive integers relatively prime to
1193
+ one another. The weights ``q`` can be given either as a list
1194
+ or tuple, or as positional arguments.
1195
+
1196
+ Two keyword arguments:
1197
+
1198
+ - ``base_ring`` -- a field (default: `\QQ`)
1199
+
1200
+ - ``names`` -- string or list (tuple) of strings (default: ``'z+'``);
1201
+ see :func:`~sage.schemes.toric.variety.normalize_names` for
1202
+ acceptable formats.
1203
+
1204
+ OUTPUT:
1205
+
1206
+ - A :class:`toric variety
1207
+ <sage.schemes.toric.variety.ToricVariety_field>`. If
1208
+ `q=(q_0,\dots,q_n)`, then the output is the weighted
1209
+ projective space `\mathbb{P}(q_0,\dots,q_n)` over
1210
+ ``base_ring``. ``names`` are the names of the generators of
1211
+ the homogeneous coordinate ring.
1212
+
1213
+ EXAMPLES:
1214
+
1215
+ A hyperelliptic curve `C` of genus 2 as a subscheme of the weighted
1216
+ projective plane `\mathbb{P}(1,3,1)`::
1217
+
1218
+ sage: X = toric_varieties.WP([1,3,1], names='x y z')
1219
+ sage: X.inject_variables()
1220
+ Defining x, y, z
1221
+ sage: g = y^2 - (x^6-z^6)
1222
+ sage: C = X.subscheme([g]); C
1223
+ Closed subscheme of 2-d toric variety covered by 3 affine patches defined by:
1224
+ -x^6 + z^6 + y^2
1225
+ """
1226
+ if len(q) == 1:
1227
+ # tuples and lists of weights are acceptable input
1228
+ if isinstance(q[0], (list, tuple)):
1229
+ q = q[0]
1230
+ q = list(q)
1231
+ m = len(q)
1232
+ # allow case q=[1]? (not allowed presently)
1233
+ if m < 2:
1234
+ raise ValueError("more than one weight must be provided (got %s)" % q)
1235
+ for i in range(m):
1236
+ try:
1237
+ q[i] = ZZ(q[i])
1238
+ except TypeError:
1239
+ raise TypeError("the weights (=%s) must be integers" % q)
1240
+ if q[i] <= 0:
1241
+ raise ValueError("the weights (=%s) must be positive integers" % q)
1242
+ if not gcd(q) == 1:
1243
+ raise ValueError("the weights (=%s) must be relatively prime" % q)
1244
+
1245
+ # set default values for base_ring and names
1246
+ base_ring = QQ
1247
+ names = 'z+'
1248
+ for key in kw:
1249
+ if key == 'K':
1250
+ base_ring = kw['K']
1251
+ elif key == 'base_ring':
1252
+ base_ring = kw['base_ring']
1253
+ elif key == 'names':
1254
+ names = kw['names']
1255
+ names = normalize_names(names, m, DEFAULT_PREFIX)
1256
+ else:
1257
+ raise TypeError("got an unexpected keyword argument %r" % key)
1258
+
1259
+ L = ToricLattice(m)
1260
+ L_sub = L.submodule([L(q)])
1261
+ Q = L / L_sub
1262
+ rays = []
1263
+ cones = []
1264
+ w = list(range(m))
1265
+ L_basis = L.basis()
1266
+ for i in w:
1267
+ b = L_basis[i]
1268
+ v = Q.coordinate_vector(Q(b))
1269
+ rays = rays + [v]
1270
+ w_c = w[:i] + w[i + 1:]
1271
+ cones = cones + [tuple(w_c)]
1272
+ fan = Fan(cones, rays)
1273
+ return ToricVariety(fan, coordinate_names=names, base_ring=base_ring)
1274
+
1275
+ def torus(self, n, names='z+', base_ring=QQ):
1276
+ r"""
1277
+ Construct the ``n``-dimensional algebraic torus `(\mathbb{F}^\times)^n`.
1278
+
1279
+ INPUT:
1280
+
1281
+ - ``n`` -- nonnegative integer. The dimension of the algebraic torus
1282
+
1283
+ - ``names`` -- string; names for the homogeneous coordinates. See
1284
+ :func:`~sage.schemes.toric.variety.normalize_names` for acceptable
1285
+ formats.
1286
+
1287
+ - ``base_ring`` -- a ring (default: `\QQ`); the base ring for
1288
+ the toric variety
1289
+
1290
+ OUTPUT: a :class:`toric variety
1291
+ <sage.schemes.toric.variety.ToricVariety_field>`.
1292
+
1293
+ EXAMPLES::
1294
+
1295
+ sage: T3 = toric_varieties.torus(3); T3
1296
+ 3-d affine toric variety
1297
+ sage: T3.fan().rays()
1298
+ Empty collection
1299
+ in 3-d lattice N
1300
+ sage: T3.fan().virtual_rays()
1301
+ N(1, 0, 0),
1302
+ N(0, 1, 0),
1303
+ N(0, 0, 1)
1304
+ in 3-d lattice N
1305
+ sage: T3.gens()
1306
+ (z0, z1, z2)
1307
+ sage: sorted(T3.change_ring(GF(3)).point_set().list())
1308
+ [[1 : 1 : 1], [1 : 1 : 2], [1 : 2 : 1], [1 : 2 : 2],
1309
+ [2 : 1 : 1], [2 : 1 : 2], [2 : 2 : 1], [2 : 2 : 2]]
1310
+ """
1311
+ try:
1312
+ n = ZZ(n)
1313
+ except TypeError:
1314
+ raise TypeError('dimension of the torus must be an integer')
1315
+ if n < 0:
1316
+ raise ValueError('dimension must be nonnegative')
1317
+ N = ToricLattice(n)
1318
+ fan = Fan([], lattice=N)
1319
+ return ToricVariety(fan, coordinate_names=names, base_field=base_ring)
1320
+
1321
+
1322
+ toric_varieties = ToricVarietyFactory()