passagemath-polyhedra 10.6.31rc3__cp314-cp314-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of passagemath-polyhedra might be problematic. Click here for more details.
- passagemath_polyhedra-10.6.31rc3.dist-info/METADATA +367 -0
- passagemath_polyhedra-10.6.31rc3.dist-info/METADATA.bak +369 -0
- passagemath_polyhedra-10.6.31rc3.dist-info/RECORD +206 -0
- passagemath_polyhedra-10.6.31rc3.dist-info/WHEEL +6 -0
- passagemath_polyhedra-10.6.31rc3.dist-info/top_level.txt +2 -0
- passagemath_polyhedra.libs/libgmp-6e109695.so.10.5.0 +0 -0
- passagemath_polyhedra.libs/libgomp-e985bcbb.so.1.0.0 +0 -0
- sage/all__sagemath_polyhedra.py +50 -0
- sage/game_theory/all.py +8 -0
- sage/game_theory/catalog.py +6 -0
- sage/game_theory/catalog_normal_form_games.py +923 -0
- sage/game_theory/cooperative_game.py +844 -0
- sage/game_theory/matching_game.py +1181 -0
- sage/game_theory/normal_form_game.py +2697 -0
- sage/game_theory/parser.py +275 -0
- sage/geometry/all__sagemath_polyhedra.py +22 -0
- sage/geometry/cone.py +6940 -0
- sage/geometry/cone_catalog.py +847 -0
- sage/geometry/cone_critical_angles.py +1027 -0
- sage/geometry/convex_set.py +1119 -0
- sage/geometry/fan.py +3743 -0
- sage/geometry/fan_isomorphism.py +389 -0
- sage/geometry/fan_morphism.py +1884 -0
- sage/geometry/hasse_diagram.py +202 -0
- sage/geometry/hyperplane_arrangement/affine_subspace.py +390 -0
- sage/geometry/hyperplane_arrangement/all.py +1 -0
- sage/geometry/hyperplane_arrangement/arrangement.py +3895 -0
- sage/geometry/hyperplane_arrangement/check_freeness.py +145 -0
- sage/geometry/hyperplane_arrangement/hyperplane.py +773 -0
- sage/geometry/hyperplane_arrangement/library.py +825 -0
- sage/geometry/hyperplane_arrangement/ordered_arrangement.py +642 -0
- sage/geometry/hyperplane_arrangement/plot.py +520 -0
- sage/geometry/integral_points.py +35 -0
- sage/geometry/integral_points_generic_dense.cpython-314-x86_64-linux-gnu.so +0 -0
- sage/geometry/integral_points_generic_dense.pyx +7 -0
- sage/geometry/lattice_polytope.py +5894 -0
- sage/geometry/linear_expression.py +773 -0
- sage/geometry/newton_polygon.py +767 -0
- sage/geometry/point_collection.cpython-314-x86_64-linux-gnu.so +0 -0
- sage/geometry/point_collection.pyx +1008 -0
- sage/geometry/polyhedral_complex.py +2616 -0
- sage/geometry/polyhedron/all.py +8 -0
- sage/geometry/polyhedron/backend_cdd.py +460 -0
- sage/geometry/polyhedron/backend_cdd_rdf.py +231 -0
- sage/geometry/polyhedron/backend_field.py +347 -0
- sage/geometry/polyhedron/backend_normaliz.py +2503 -0
- sage/geometry/polyhedron/backend_number_field.py +168 -0
- sage/geometry/polyhedron/backend_polymake.py +765 -0
- sage/geometry/polyhedron/backend_ppl.py +582 -0
- sage/geometry/polyhedron/base.py +1206 -0
- sage/geometry/polyhedron/base0.py +1444 -0
- sage/geometry/polyhedron/base1.py +886 -0
- sage/geometry/polyhedron/base2.py +812 -0
- sage/geometry/polyhedron/base3.py +1845 -0
- sage/geometry/polyhedron/base4.py +1262 -0
- sage/geometry/polyhedron/base5.py +2700 -0
- sage/geometry/polyhedron/base6.py +1741 -0
- sage/geometry/polyhedron/base7.py +997 -0
- sage/geometry/polyhedron/base_QQ.py +1258 -0
- sage/geometry/polyhedron/base_RDF.py +98 -0
- sage/geometry/polyhedron/base_ZZ.py +934 -0
- sage/geometry/polyhedron/base_mutable.py +215 -0
- sage/geometry/polyhedron/base_number_field.py +122 -0
- sage/geometry/polyhedron/cdd_file_format.py +155 -0
- sage/geometry/polyhedron/combinatorial_polyhedron/all.py +1 -0
- sage/geometry/polyhedron/combinatorial_polyhedron/base.cpython-314-x86_64-linux-gnu.so +0 -0
- sage/geometry/polyhedron/combinatorial_polyhedron/base.pxd +76 -0
- sage/geometry/polyhedron/combinatorial_polyhedron/base.pyx +3859 -0
- sage/geometry/polyhedron/combinatorial_polyhedron/combinatorial_face.cpython-314-x86_64-linux-gnu.so +0 -0
- sage/geometry/polyhedron/combinatorial_polyhedron/combinatorial_face.pxd +39 -0
- sage/geometry/polyhedron/combinatorial_polyhedron/combinatorial_face.pyx +1038 -0
- sage/geometry/polyhedron/combinatorial_polyhedron/conversions.cpython-314-x86_64-linux-gnu.so +0 -0
- sage/geometry/polyhedron/combinatorial_polyhedron/conversions.pxd +9 -0
- sage/geometry/polyhedron/combinatorial_polyhedron/conversions.pyx +501 -0
- sage/geometry/polyhedron/combinatorial_polyhedron/face_data_structure.pxd +207 -0
- sage/geometry/polyhedron/combinatorial_polyhedron/face_iterator.cpython-314-x86_64-linux-gnu.so +0 -0
- sage/geometry/polyhedron/combinatorial_polyhedron/face_iterator.pxd +102 -0
- sage/geometry/polyhedron/combinatorial_polyhedron/face_iterator.pyx +2274 -0
- sage/geometry/polyhedron/combinatorial_polyhedron/face_list_data_structure.cpython-314-x86_64-linux-gnu.so +0 -0
- sage/geometry/polyhedron/combinatorial_polyhedron/face_list_data_structure.pxd +370 -0
- sage/geometry/polyhedron/combinatorial_polyhedron/face_list_data_structure.pyx +84 -0
- sage/geometry/polyhedron/combinatorial_polyhedron/list_of_faces.cpython-314-x86_64-linux-gnu.so +0 -0
- sage/geometry/polyhedron/combinatorial_polyhedron/list_of_faces.pxd +31 -0
- sage/geometry/polyhedron/combinatorial_polyhedron/list_of_faces.pyx +587 -0
- sage/geometry/polyhedron/combinatorial_polyhedron/polyhedron_face_lattice.cpython-314-x86_64-linux-gnu.so +0 -0
- sage/geometry/polyhedron/combinatorial_polyhedron/polyhedron_face_lattice.pxd +52 -0
- sage/geometry/polyhedron/combinatorial_polyhedron/polyhedron_face_lattice.pyx +560 -0
- sage/geometry/polyhedron/constructor.py +773 -0
- sage/geometry/polyhedron/double_description.py +753 -0
- sage/geometry/polyhedron/double_description_inhomogeneous.py +564 -0
- sage/geometry/polyhedron/face.py +1060 -0
- sage/geometry/polyhedron/generating_function.py +1810 -0
- sage/geometry/polyhedron/lattice_euclidean_group_element.py +178 -0
- sage/geometry/polyhedron/library.py +3502 -0
- sage/geometry/polyhedron/misc.py +121 -0
- sage/geometry/polyhedron/modules/all.py +1 -0
- sage/geometry/polyhedron/modules/formal_polyhedra_module.py +155 -0
- sage/geometry/polyhedron/palp_database.py +447 -0
- sage/geometry/polyhedron/parent.py +1279 -0
- sage/geometry/polyhedron/plot.py +1986 -0
- sage/geometry/polyhedron/ppl_lattice_polygon.py +556 -0
- sage/geometry/polyhedron/ppl_lattice_polytope.py +1257 -0
- sage/geometry/polyhedron/representation.py +1723 -0
- sage/geometry/pseudolines.py +515 -0
- sage/geometry/relative_interior.py +445 -0
- sage/geometry/toric_plotter.py +1103 -0
- sage/geometry/triangulation/all.py +2 -0
- sage/geometry/triangulation/base.cpython-314-x86_64-linux-gnu.so +0 -0
- sage/geometry/triangulation/base.pyx +963 -0
- sage/geometry/triangulation/data.h +147 -0
- sage/geometry/triangulation/data.pxd +4 -0
- sage/geometry/triangulation/element.py +914 -0
- sage/geometry/triangulation/functions.h +10 -0
- sage/geometry/triangulation/functions.pxd +4 -0
- sage/geometry/triangulation/point_configuration.py +2256 -0
- sage/geometry/triangulation/triangulations.h +49 -0
- sage/geometry/triangulation/triangulations.pxd +7 -0
- sage/geometry/voronoi_diagram.py +319 -0
- sage/interfaces/all__sagemath_polyhedra.py +1 -0
- sage/interfaces/polymake.py +2028 -0
- sage/numerical/all.py +13 -0
- sage/numerical/all__sagemath_polyhedra.py +11 -0
- sage/numerical/backends/all.py +1 -0
- sage/numerical/backends/all__sagemath_polyhedra.py +1 -0
- sage/numerical/backends/cvxopt_backend.cpython-314-x86_64-linux-gnu.so +0 -0
- sage/numerical/backends/cvxopt_backend.pyx +1006 -0
- sage/numerical/backends/cvxopt_backend_test.py +19 -0
- sage/numerical/backends/cvxopt_sdp_backend.cpython-314-x86_64-linux-gnu.so +0 -0
- sage/numerical/backends/cvxopt_sdp_backend.pyx +382 -0
- sage/numerical/backends/cvxpy_backend.cpython-314-x86_64-linux-gnu.so +0 -0
- sage/numerical/backends/cvxpy_backend.pxd +41 -0
- sage/numerical/backends/cvxpy_backend.pyx +934 -0
- sage/numerical/backends/cvxpy_backend_test.py +13 -0
- sage/numerical/backends/generic_backend_test.py +24 -0
- sage/numerical/backends/interactivelp_backend.cpython-314-x86_64-linux-gnu.so +0 -0
- sage/numerical/backends/interactivelp_backend.pxd +36 -0
- sage/numerical/backends/interactivelp_backend.pyx +1231 -0
- sage/numerical/backends/interactivelp_backend_test.py +12 -0
- sage/numerical/backends/logging_backend.py +391 -0
- sage/numerical/backends/matrix_sdp_backend.cpython-314-x86_64-linux-gnu.so +0 -0
- sage/numerical/backends/matrix_sdp_backend.pxd +15 -0
- sage/numerical/backends/matrix_sdp_backend.pyx +478 -0
- sage/numerical/backends/ppl_backend.cpython-314-x86_64-linux-gnu.so +0 -0
- sage/numerical/backends/ppl_backend.pyx +1126 -0
- sage/numerical/backends/ppl_backend_test.py +13 -0
- sage/numerical/backends/scip_backend.cpython-314-x86_64-linux-gnu.so +0 -0
- sage/numerical/backends/scip_backend.pxd +22 -0
- sage/numerical/backends/scip_backend.pyx +1289 -0
- sage/numerical/backends/scip_backend_test.py +13 -0
- sage/numerical/interactive_simplex_method.py +5338 -0
- sage/numerical/knapsack.py +665 -0
- sage/numerical/linear_functions.cpython-314-x86_64-linux-gnu.so +0 -0
- sage/numerical/linear_functions.pxd +31 -0
- sage/numerical/linear_functions.pyx +1648 -0
- sage/numerical/linear_tensor.py +470 -0
- sage/numerical/linear_tensor_constraints.py +448 -0
- sage/numerical/linear_tensor_element.cpython-314-x86_64-linux-gnu.so +0 -0
- sage/numerical/linear_tensor_element.pxd +6 -0
- sage/numerical/linear_tensor_element.pyx +459 -0
- sage/numerical/mip.cpython-314-x86_64-linux-gnu.so +0 -0
- sage/numerical/mip.pxd +40 -0
- sage/numerical/mip.pyx +3667 -0
- sage/numerical/sdp.cpython-314-x86_64-linux-gnu.so +0 -0
- sage/numerical/sdp.pxd +39 -0
- sage/numerical/sdp.pyx +1433 -0
- sage/rings/all__sagemath_polyhedra.py +3 -0
- sage/rings/polynomial/all__sagemath_polyhedra.py +10 -0
- sage/rings/polynomial/omega.py +982 -0
- sage/schemes/all__sagemath_polyhedra.py +2 -0
- sage/schemes/toric/all.py +10 -0
- sage/schemes/toric/chow_group.py +1248 -0
- sage/schemes/toric/divisor.py +2082 -0
- sage/schemes/toric/divisor_class.cpython-314-x86_64-linux-gnu.so +0 -0
- sage/schemes/toric/divisor_class.pyx +322 -0
- sage/schemes/toric/fano_variety.py +1606 -0
- sage/schemes/toric/homset.py +650 -0
- sage/schemes/toric/ideal.py +451 -0
- sage/schemes/toric/library.py +1322 -0
- sage/schemes/toric/morphism.py +1958 -0
- sage/schemes/toric/points.py +1032 -0
- sage/schemes/toric/sheaf/all.py +1 -0
- sage/schemes/toric/sheaf/constructor.py +302 -0
- sage/schemes/toric/sheaf/klyachko.py +921 -0
- sage/schemes/toric/toric_subscheme.py +905 -0
- sage/schemes/toric/variety.py +3460 -0
- sage/schemes/toric/weierstrass.py +1078 -0
- sage/schemes/toric/weierstrass_covering.py +457 -0
- sage/schemes/toric/weierstrass_higher.py +288 -0
- sage_wheels/share/reflexive_polytopes/Full2d/zzdb.info +10 -0
- sage_wheels/share/reflexive_polytopes/Full2d/zzdb.v03 +0 -0
- sage_wheels/share/reflexive_polytopes/Full2d/zzdb.v04 +0 -0
- sage_wheels/share/reflexive_polytopes/Full2d/zzdb.v05 +1 -0
- sage_wheels/share/reflexive_polytopes/Full2d/zzdb.v06 +1 -0
- sage_wheels/share/reflexive_polytopes/Full3d/zzdb.info +22 -0
- sage_wheels/share/reflexive_polytopes/Full3d/zzdb.v04 +0 -0
- sage_wheels/share/reflexive_polytopes/Full3d/zzdb.v05 +0 -0
- sage_wheels/share/reflexive_polytopes/Full3d/zzdb.v06 +0 -0
- sage_wheels/share/reflexive_polytopes/Full3d/zzdb.v07 +0 -0
- sage_wheels/share/reflexive_polytopes/Full3d/zzdb.v08 +0 -0
- sage_wheels/share/reflexive_polytopes/Full3d/zzdb.v09 +0 -0
- sage_wheels/share/reflexive_polytopes/Full3d/zzdb.v10 +0 -0
- sage_wheels/share/reflexive_polytopes/Full3d/zzdb.v11 +1 -0
- sage_wheels/share/reflexive_polytopes/Full3d/zzdb.v12 +1 -0
- sage_wheels/share/reflexive_polytopes/Full3d/zzdb.v13 +1 -0
- sage_wheels/share/reflexive_polytopes/reflexive_polytopes_2d +80 -0
- sage_wheels/share/reflexive_polytopes/reflexive_polytopes_3d +37977 -0
|
@@ -0,0 +1,650 @@
|
|
|
1
|
+
# sage_setup: distribution = sagemath-polyhedra
|
|
2
|
+
# sage.doctest: needs sage.geometry.polyhedron sage.graphs
|
|
3
|
+
r"""
|
|
4
|
+
Set of homomorphisms between two toric varieties
|
|
5
|
+
|
|
6
|
+
For schemes `X` and `Y`, this module implements the set of morphisms
|
|
7
|
+
`Hom(X,Y)`. This is done by
|
|
8
|
+
:class:`~sage.schemes.generic.homset.SchemeHomset_generic`.
|
|
9
|
+
|
|
10
|
+
As a special case, the Hom-sets can also represent the points of a
|
|
11
|
+
scheme. Recall that the `K`-rational points of a scheme `X` over `k`
|
|
12
|
+
can be identified with the set of morphisms `Spec(K) \to X`. In Sage,
|
|
13
|
+
the rational points are implemented by such scheme morphisms. This is
|
|
14
|
+
done by :class:`~sage.schemes.generic.homset.SchemeHomset_points` and
|
|
15
|
+
its subclasses.
|
|
16
|
+
|
|
17
|
+
.. NOTE::
|
|
18
|
+
|
|
19
|
+
You should not create the Hom-sets manually. Instead, use the
|
|
20
|
+
:meth:`~sage.structure.parent.Hom` method that is inherited by all
|
|
21
|
+
schemes.
|
|
22
|
+
|
|
23
|
+
AUTHORS:
|
|
24
|
+
|
|
25
|
+
- Volker Braun (2012-02-18): Initial version
|
|
26
|
+
|
|
27
|
+
EXAMPLES:
|
|
28
|
+
|
|
29
|
+
Here is a simple example, the projection of
|
|
30
|
+
`\mathbb{P}^1\times\mathbb{P}^1\to \mathbb{P}^1` ::
|
|
31
|
+
|
|
32
|
+
sage: P1xP1 = toric_varieties.P1xP1()
|
|
33
|
+
sage: P1 = toric_varieties.P1()
|
|
34
|
+
sage: hom_set = P1xP1.Hom(P1); hom_set
|
|
35
|
+
Set of morphisms
|
|
36
|
+
From: 2-d CPR-Fano toric variety covered by 4 affine patches
|
|
37
|
+
To: 1-d CPR-Fano toric variety covered by 2 affine patches
|
|
38
|
+
|
|
39
|
+
In terms of the fan, we can define this morphism by the projection
|
|
40
|
+
onto the first coordinate. The Hom-set can construct the morphism from
|
|
41
|
+
the projection matrix alone::
|
|
42
|
+
|
|
43
|
+
sage: hom_set(matrix([[1],[0]]))
|
|
44
|
+
Scheme morphism:
|
|
45
|
+
From: 2-d CPR-Fano toric variety covered by 4 affine patches
|
|
46
|
+
To: 1-d CPR-Fano toric variety covered by 2 affine patches
|
|
47
|
+
Defn: Defined by sending Rational polyhedral fan in 2-d lattice N
|
|
48
|
+
to Rational polyhedral fan in 1-d lattice N.
|
|
49
|
+
sage: _.as_polynomial_map()
|
|
50
|
+
Scheme morphism:
|
|
51
|
+
From: 2-d CPR-Fano toric variety covered by 4 affine patches
|
|
52
|
+
To: 1-d CPR-Fano toric variety covered by 2 affine patches
|
|
53
|
+
Defn: Defined on coordinates by sending [s : t : x : y] to [s : t]
|
|
54
|
+
|
|
55
|
+
In the case of toric algebraic schemes (defined by polynomials in
|
|
56
|
+
toric varieties), this module defines the underlying morphism of the
|
|
57
|
+
ambient toric varieties::
|
|
58
|
+
|
|
59
|
+
sage: P1xP1.inject_variables()
|
|
60
|
+
Defining s, t, x, y
|
|
61
|
+
sage: S = P1xP1.subscheme([s*x - t*y])
|
|
62
|
+
sage: type(S.Hom(S))
|
|
63
|
+
<class 'sage.schemes.toric.homset.SchemeHomset_toric_variety_with_category'>
|
|
64
|
+
|
|
65
|
+
Finally, you can have morphisms defined through homogeneous
|
|
66
|
+
coordinates where the codomain is not implemented as a toric variety::
|
|
67
|
+
|
|
68
|
+
sage: P2_toric.<x,y,z> = toric_varieties.P2()
|
|
69
|
+
sage: P2_native.<u,v,w> = ProjectiveSpace(QQ, 2)
|
|
70
|
+
sage: toric_to_native = P2_toric.Hom(P2_native); toric_to_native
|
|
71
|
+
Set of morphisms
|
|
72
|
+
From: 2-d CPR-Fano toric variety covered by 3 affine patches
|
|
73
|
+
To: Projective Space of dimension 2 over Rational Field
|
|
74
|
+
sage: type(toric_to_native)
|
|
75
|
+
<class 'sage.schemes.toric.homset.SchemeHomset_toric_variety_with_category'>
|
|
76
|
+
sage: toric_to_native([x^2, y^2, z^2])
|
|
77
|
+
Scheme morphism:
|
|
78
|
+
From: 2-d CPR-Fano toric variety covered by 3 affine patches
|
|
79
|
+
To: Projective Space of dimension 2 over Rational Field
|
|
80
|
+
Defn: Defined on coordinates by sending [x : y : z] to (x^2 : y^2 : z^2)
|
|
81
|
+
|
|
82
|
+
sage: native_to_toric = P2_native.Hom(P2_toric); native_to_toric
|
|
83
|
+
Set of morphisms
|
|
84
|
+
From: Projective Space of dimension 2 over Rational Field
|
|
85
|
+
To: 2-d CPR-Fano toric variety covered by 3 affine patches
|
|
86
|
+
sage: type(native_to_toric)
|
|
87
|
+
<class 'sage.schemes.projective.projective_homset.SchemeHomset_polynomial_projective_space_with_category'>
|
|
88
|
+
sage: native_to_toric([u^2, v^2, w^2])
|
|
89
|
+
Scheme morphism:
|
|
90
|
+
From: Projective Space of dimension 2 over Rational Field
|
|
91
|
+
To: 2-d CPR-Fano toric variety covered by 3 affine patches
|
|
92
|
+
Defn: Defined on coordinates by sending (u : v : w) to [u^2 : v^2 : w^2]
|
|
93
|
+
"""
|
|
94
|
+
|
|
95
|
+
# ****************************************************************************
|
|
96
|
+
# Copyright (C) 2010 Volker Braun <vbraun.name@gmail.com>
|
|
97
|
+
# Copyright (C) 2010 Andrey Novoseltsev <novoselt@gmail.com>
|
|
98
|
+
#
|
|
99
|
+
# Distributed under the terms of the GNU General Public License (GPL)
|
|
100
|
+
# as published by the Free Software Foundation; either version 2 of
|
|
101
|
+
# the License, or (at your option) any later version.
|
|
102
|
+
# https://www.gnu.org/licenses/
|
|
103
|
+
# ****************************************************************************
|
|
104
|
+
|
|
105
|
+
from sage.categories.finite_fields import FiniteFields
|
|
106
|
+
from sage.rings.integer_ring import ZZ
|
|
107
|
+
|
|
108
|
+
from sage.structure.element import Matrix
|
|
109
|
+
from sage.matrix.matrix_space import MatrixSpace
|
|
110
|
+
from sage.geometry.fan_morphism import FanMorphism
|
|
111
|
+
|
|
112
|
+
from sage.schemes.generic.homset import (SchemeHomset_generic,
|
|
113
|
+
SchemeHomset_points)
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
class SchemeHomset_toric_variety(SchemeHomset_generic):
|
|
117
|
+
"""
|
|
118
|
+
Set of homomorphisms between two toric varieties.
|
|
119
|
+
|
|
120
|
+
EXAMPLES::
|
|
121
|
+
|
|
122
|
+
sage: P1xP1 = toric_varieties.P1xP1()
|
|
123
|
+
sage: P1 = toric_varieties.P1()
|
|
124
|
+
sage: hom_set = P1xP1.Hom(P1); hom_set
|
|
125
|
+
Set of morphisms
|
|
126
|
+
From: 2-d CPR-Fano toric variety covered by 4 affine patches
|
|
127
|
+
To: 1-d CPR-Fano toric variety covered by 2 affine patches
|
|
128
|
+
sage: type(hom_set)
|
|
129
|
+
<class 'sage.schemes.toric.homset.SchemeHomset_toric_variety_with_category'>
|
|
130
|
+
|
|
131
|
+
sage: hom_set(matrix([[1],[0]]))
|
|
132
|
+
Scheme morphism:
|
|
133
|
+
From: 2-d CPR-Fano toric variety covered by 4 affine patches
|
|
134
|
+
To: 1-d CPR-Fano toric variety covered by 2 affine patches
|
|
135
|
+
Defn: Defined by sending Rational polyhedral fan in 2-d lattice N
|
|
136
|
+
to Rational polyhedral fan in 1-d lattice N.
|
|
137
|
+
"""
|
|
138
|
+
|
|
139
|
+
def __init__(self, X, Y, category=None, check=True, base=ZZ):
|
|
140
|
+
"""
|
|
141
|
+
The Python constructor.
|
|
142
|
+
|
|
143
|
+
INPUT:
|
|
144
|
+
|
|
145
|
+
The same as for any homset, see
|
|
146
|
+
:mod:`~sage.categories.homset`.
|
|
147
|
+
|
|
148
|
+
EXAMPLES::
|
|
149
|
+
|
|
150
|
+
sage: P1xP1 = toric_varieties.P1xP1()
|
|
151
|
+
sage: P1 = toric_varieties.P1()
|
|
152
|
+
sage: hom_set = P1xP1.Hom(P1); hom_set
|
|
153
|
+
Set of morphisms
|
|
154
|
+
From: 2-d CPR-Fano toric variety covered by 4 affine patches
|
|
155
|
+
To: 1-d CPR-Fano toric variety covered by 2 affine patches
|
|
156
|
+
|
|
157
|
+
An integral matrix defines a fan morphism, since we think of
|
|
158
|
+
the matrix as a linear map on the toric lattice. This is why
|
|
159
|
+
we need to ``register_conversion`` in the constructor
|
|
160
|
+
below. The result is::
|
|
161
|
+
|
|
162
|
+
sage: hom_set(matrix([[1],[0]]))
|
|
163
|
+
Scheme morphism:
|
|
164
|
+
From: 2-d CPR-Fano toric variety covered by 4 affine patches
|
|
165
|
+
To: 1-d CPR-Fano toric variety covered by 2 affine patches
|
|
166
|
+
Defn: Defined by sending Rational polyhedral fan in 2-d lattice N
|
|
167
|
+
to Rational polyhedral fan in 1-d lattice N.
|
|
168
|
+
"""
|
|
169
|
+
SchemeHomset_generic.__init__(self, X, Y, category=category, check=check, base=base)
|
|
170
|
+
from sage.schemes.toric.variety import ToricVariety_field
|
|
171
|
+
if isinstance(X, ToricVariety_field) and isinstance(Y, ToricVariety_field):
|
|
172
|
+
self.register_conversion(MatrixSpace(ZZ, X.fan().dim(), Y.fan().dim()))
|
|
173
|
+
|
|
174
|
+
def _element_constructor_(self, x, check=True):
|
|
175
|
+
"""
|
|
176
|
+
Construct a scheme morphism.
|
|
177
|
+
|
|
178
|
+
INPUT:
|
|
179
|
+
|
|
180
|
+
- ``x`` -- anything that defines a morphism of toric
|
|
181
|
+
varieties. A matrix, fan morphism, or a list or tuple of
|
|
182
|
+
homogeneous polynomials that define a morphism.
|
|
183
|
+
|
|
184
|
+
- ``check`` -- boolean (default: ``True``); passed onto
|
|
185
|
+
functions called by this to be more careful about input
|
|
186
|
+
argument type checking
|
|
187
|
+
|
|
188
|
+
OUTPUT: the morphism of toric varieties determined by ``x``
|
|
189
|
+
|
|
190
|
+
EXAMPLES:
|
|
191
|
+
|
|
192
|
+
First, construct from fan morphism::
|
|
193
|
+
|
|
194
|
+
sage: dP8.<t,x0,x1,x2> = toric_varieties.dP8()
|
|
195
|
+
sage: P2.<y0,y1,y2> = toric_varieties.P2()
|
|
196
|
+
sage: hom_set = dP8.Hom(P2)
|
|
197
|
+
|
|
198
|
+
sage: fm = FanMorphism(identity_matrix(2), dP8.fan(), P2.fan())
|
|
199
|
+
sage: hom_set(fm) # calls hom_set._element_constructor_()
|
|
200
|
+
Scheme morphism:
|
|
201
|
+
From: 2-d CPR-Fano toric variety covered by 4 affine patches
|
|
202
|
+
To: 2-d CPR-Fano toric variety covered by 3 affine patches
|
|
203
|
+
Defn: Defined by sending Rational polyhedral fan in 2-d lattice N
|
|
204
|
+
to Rational polyhedral fan in 2-d lattice N.
|
|
205
|
+
|
|
206
|
+
A matrix will automatically be converted to a fan morphism::
|
|
207
|
+
|
|
208
|
+
sage: hom_set(identity_matrix(2))
|
|
209
|
+
Scheme morphism:
|
|
210
|
+
From: 2-d CPR-Fano toric variety covered by 4 affine patches
|
|
211
|
+
To: 2-d CPR-Fano toric variety covered by 3 affine patches
|
|
212
|
+
Defn: Defined by sending Rational polyhedral fan in 2-d lattice N
|
|
213
|
+
to Rational polyhedral fan in 2-d lattice N.
|
|
214
|
+
|
|
215
|
+
Alternatively, one can use homogeneous polynomials to define morphisms::
|
|
216
|
+
|
|
217
|
+
sage: P2.inject_variables()
|
|
218
|
+
Defining y0, y1, y2
|
|
219
|
+
sage: dP8.inject_variables()
|
|
220
|
+
Defining t, x0, x1, x2
|
|
221
|
+
sage: hom_set([x0,x1,x2])
|
|
222
|
+
Scheme morphism:
|
|
223
|
+
From: 2-d CPR-Fano toric variety covered by 4 affine patches
|
|
224
|
+
To: 2-d CPR-Fano toric variety covered by 3 affine patches
|
|
225
|
+
Defn: Defined on coordinates by sending [t : x0 : x1 : x2] to
|
|
226
|
+
[x0 : x1 : x2]
|
|
227
|
+
|
|
228
|
+
A morphism of the coordinate ring will also work::
|
|
229
|
+
|
|
230
|
+
sage: ring_hom = P2.coordinate_ring().hom([x0,x1,x2], dP8.coordinate_ring())
|
|
231
|
+
sage: ring_hom
|
|
232
|
+
Ring morphism:
|
|
233
|
+
From: Multivariate Polynomial Ring in y0, y1, y2 over Rational Field
|
|
234
|
+
To: Multivariate Polynomial Ring in t, x0, x1, x2 over Rational Field
|
|
235
|
+
Defn: y0 |--> x0
|
|
236
|
+
y1 |--> x1
|
|
237
|
+
y2 |--> x2
|
|
238
|
+
sage: hom_set(ring_hom)
|
|
239
|
+
Scheme morphism:
|
|
240
|
+
From: 2-d CPR-Fano toric variety covered by 4 affine patches
|
|
241
|
+
To: 2-d CPR-Fano toric variety covered by 3 affine patches
|
|
242
|
+
Defn: Defined on coordinates by sending [t : x0 : x1 : x2] to
|
|
243
|
+
[x0 : x1 : x2]
|
|
244
|
+
"""
|
|
245
|
+
from sage.schemes.toric.morphism import SchemeMorphism_polynomial_toric_variety
|
|
246
|
+
if isinstance(x, (list, tuple)):
|
|
247
|
+
return SchemeMorphism_polynomial_toric_variety(self, x, check=check)
|
|
248
|
+
|
|
249
|
+
from sage.categories.map import Map
|
|
250
|
+
from sage.categories.rings import Rings
|
|
251
|
+
if isinstance(x, Map) and x.category_for().is_subcategory(Rings()):
|
|
252
|
+
# x is a morphism of Rings
|
|
253
|
+
assert x.domain() is self.codomain().coordinate_ring()
|
|
254
|
+
assert x.codomain() is self.domain().coordinate_ring()
|
|
255
|
+
return SchemeMorphism_polynomial_toric_variety(self, x.im_gens(), check=check)
|
|
256
|
+
|
|
257
|
+
if isinstance(x, Matrix):
|
|
258
|
+
x = FanMorphism(x, self.domain().fan(), self.codomain().fan())
|
|
259
|
+
if isinstance(x, FanMorphism):
|
|
260
|
+
if x.is_dominant():
|
|
261
|
+
from sage.schemes.toric.morphism import SchemeMorphism_fan_toric_variety_dominant
|
|
262
|
+
return SchemeMorphism_fan_toric_variety_dominant(self, x, check=check)
|
|
263
|
+
else:
|
|
264
|
+
from sage.schemes.toric.morphism import SchemeMorphism_fan_toric_variety
|
|
265
|
+
return SchemeMorphism_fan_toric_variety(self, x, check=check)
|
|
266
|
+
|
|
267
|
+
raise TypeError("x must be a fan morphism or a list/tuple of polynomials")
|
|
268
|
+
|
|
269
|
+
def _an_element_(self):
|
|
270
|
+
"""
|
|
271
|
+
Construct a sample morphism.
|
|
272
|
+
|
|
273
|
+
OUTPUT: an element of the homset
|
|
274
|
+
|
|
275
|
+
EXAMPLES::
|
|
276
|
+
|
|
277
|
+
sage: P2 = toric_varieties.P2()
|
|
278
|
+
sage: homset = P2.Hom(P2)
|
|
279
|
+
sage: homset.an_element() # indirect doctest
|
|
280
|
+
Scheme endomorphism of 2-d CPR-Fano toric variety covered by 3 affine patches
|
|
281
|
+
Defn: Defined by sending Rational polyhedral fan in 2-d lattice N to
|
|
282
|
+
Rational polyhedral fan in 2-d lattice N.
|
|
283
|
+
"""
|
|
284
|
+
from sage.matrix.constructor import zero_matrix
|
|
285
|
+
zero = zero_matrix(self.domain().dimension_relative(),
|
|
286
|
+
self.codomain().dimension_relative())
|
|
287
|
+
return self(zero)
|
|
288
|
+
|
|
289
|
+
|
|
290
|
+
class SchemeHomset_points_toric_base(SchemeHomset_points):
|
|
291
|
+
"""
|
|
292
|
+
Base class for homsets with toric ambient spaces.
|
|
293
|
+
|
|
294
|
+
INPUT:
|
|
295
|
+
|
|
296
|
+
- same as for :class:`SchemeHomset_points`.
|
|
297
|
+
|
|
298
|
+
OUTPUT: a scheme morphism of type :class:`SchemeHomset_points_toric_base`
|
|
299
|
+
|
|
300
|
+
EXAMPLES::
|
|
301
|
+
|
|
302
|
+
sage: P1xP1 = toric_varieties.P1xP1()
|
|
303
|
+
sage: P1xP1(QQ)
|
|
304
|
+
Set of rational points of 2-d CPR-Fano toric variety
|
|
305
|
+
covered by 4 affine patches
|
|
306
|
+
|
|
307
|
+
TESTS::
|
|
308
|
+
|
|
309
|
+
sage: import sage.schemes.toric.homset as HOM
|
|
310
|
+
sage: HOM.SchemeHomset_points_toric_base(Spec(QQ), P1xP1)
|
|
311
|
+
Set of rational points of 2-d CPR-Fano toric variety covered by 4 affine patches
|
|
312
|
+
"""
|
|
313
|
+
|
|
314
|
+
def is_finite(self):
|
|
315
|
+
"""
|
|
316
|
+
Return whether there are finitely many points.
|
|
317
|
+
|
|
318
|
+
OUTPUT: boolean
|
|
319
|
+
|
|
320
|
+
EXAMPLES::
|
|
321
|
+
|
|
322
|
+
sage: P2 = toric_varieties.P2()
|
|
323
|
+
sage: P2.point_set().is_finite()
|
|
324
|
+
False
|
|
325
|
+
sage: P2.change_ring(GF(7)).point_set().is_finite()
|
|
326
|
+
True
|
|
327
|
+
"""
|
|
328
|
+
variety = self.codomain()
|
|
329
|
+
return variety.dimension() == 0 or variety.base_ring().is_finite()
|
|
330
|
+
|
|
331
|
+
def _naive_enumerator(self, ring=None):
|
|
332
|
+
"""
|
|
333
|
+
The naive enumerator over points of the toric variety.
|
|
334
|
+
|
|
335
|
+
INPUT:
|
|
336
|
+
|
|
337
|
+
- ``ring`` -- a ring (optional; defaults to the base ring of
|
|
338
|
+
the toric variety). The ring over which the points are
|
|
339
|
+
considered.
|
|
340
|
+
|
|
341
|
+
OUTPUT:
|
|
342
|
+
|
|
343
|
+
A :class:`sage.schemes.toric.points.NaiveFinitePointEnumerator`
|
|
344
|
+
instance that can be used to iterate over the points.
|
|
345
|
+
|
|
346
|
+
EXAMPLES::
|
|
347
|
+
|
|
348
|
+
sage: P123 = toric_varieties.P2_123(base_ring=GF(3))
|
|
349
|
+
sage: point_set = P123.point_set()
|
|
350
|
+
sage: next(iter(point_set._naive_enumerator()))
|
|
351
|
+
(0, 0, 1)
|
|
352
|
+
sage: next(iter(point_set))
|
|
353
|
+
[0 : 0 : 1]
|
|
354
|
+
"""
|
|
355
|
+
from sage.schemes.toric.points import NaiveFinitePointEnumerator
|
|
356
|
+
variety = self.codomain()
|
|
357
|
+
if ring is None:
|
|
358
|
+
ring = variety.base_ring()
|
|
359
|
+
return NaiveFinitePointEnumerator(variety.fan(), ring)
|
|
360
|
+
|
|
361
|
+
def _finite_field_enumerator(self, finite_field=None):
|
|
362
|
+
"""
|
|
363
|
+
Fast enumerator for points of the toric variety.
|
|
364
|
+
|
|
365
|
+
INPUT:
|
|
366
|
+
|
|
367
|
+
- ``finite_field`` -- a finite field (optional; defaults to
|
|
368
|
+
the base ring of the toric variety). The ring over which the
|
|
369
|
+
points are considered.
|
|
370
|
+
|
|
371
|
+
OUTPUT:
|
|
372
|
+
|
|
373
|
+
A
|
|
374
|
+
:class:`sage.schemes.toric.points.FiniteFieldPointEnumerator`
|
|
375
|
+
instance that can be used to iterate over the points.
|
|
376
|
+
|
|
377
|
+
EXAMPLES::
|
|
378
|
+
|
|
379
|
+
sage: P123 = toric_varieties.P2_123(base_ring=GF(3))
|
|
380
|
+
sage: point_set = P123.point_set()
|
|
381
|
+
sage: next(iter(point_set._finite_field_enumerator()))
|
|
382
|
+
(0, 0, 1)
|
|
383
|
+
sage: next(iter(point_set))
|
|
384
|
+
[0 : 0 : 1]
|
|
385
|
+
"""
|
|
386
|
+
from sage.schemes.toric.points import FiniteFieldPointEnumerator
|
|
387
|
+
variety = self.codomain()
|
|
388
|
+
if finite_field is None:
|
|
389
|
+
finite_field = variety.base_ring()
|
|
390
|
+
if finite_field not in FiniteFields():
|
|
391
|
+
raise ValueError('not a finite field')
|
|
392
|
+
return FiniteFieldPointEnumerator(variety.fan(), finite_field)
|
|
393
|
+
|
|
394
|
+
def _enumerator(self):
|
|
395
|
+
"""
|
|
396
|
+
Return the most suitable enumerator for points.
|
|
397
|
+
|
|
398
|
+
OUTPUT:
|
|
399
|
+
|
|
400
|
+
An iterable that yields the coordinates of all points as
|
|
401
|
+
tuples.
|
|
402
|
+
|
|
403
|
+
EXAMPLES::
|
|
404
|
+
|
|
405
|
+
sage: P123 = toric_varieties.P2_123(base_ring=GF(3))
|
|
406
|
+
sage: point_set = P123.point_set()
|
|
407
|
+
sage: point_set._enumerator()
|
|
408
|
+
<sage.schemes.toric.points.FiniteFieldPointEnumerator object at 0x...>
|
|
409
|
+
"""
|
|
410
|
+
ring = self.domain().base_ring()
|
|
411
|
+
if ring in FiniteFields():
|
|
412
|
+
return self._finite_field_enumerator()
|
|
413
|
+
elif ring.is_finite():
|
|
414
|
+
return self._naive_enumerator()
|
|
415
|
+
else:
|
|
416
|
+
from sage.schemes.toric.points import InfinitePointEnumerator
|
|
417
|
+
return InfinitePointEnumerator(self.codomain().fan(), ring)
|
|
418
|
+
|
|
419
|
+
|
|
420
|
+
class SchemeHomset_points_toric_field(SchemeHomset_points_toric_base):
|
|
421
|
+
r"""
|
|
422
|
+
Set of rational points of a toric variety.
|
|
423
|
+
|
|
424
|
+
You should not use this class directly. Instead, use the
|
|
425
|
+
:meth:`~sage.schemes.generic.scheme.Scheme.point_set` method to
|
|
426
|
+
construct the point set of a toric variety.
|
|
427
|
+
|
|
428
|
+
INPUT:
|
|
429
|
+
|
|
430
|
+
- same as for :class:`~sage.schemes.generic.homset.SchemeHomset_points`.
|
|
431
|
+
|
|
432
|
+
OUTPUT: a scheme morphism of type :class:`SchemeHomset_points_toric_field`
|
|
433
|
+
|
|
434
|
+
EXAMPLES::
|
|
435
|
+
|
|
436
|
+
sage: P1xP1 = toric_varieties.P1xP1()
|
|
437
|
+
sage: P1xP1.point_set()
|
|
438
|
+
Set of rational points of 2-d CPR-Fano toric variety
|
|
439
|
+
covered by 4 affine patches
|
|
440
|
+
sage: P1xP1(QQ)
|
|
441
|
+
Set of rational points of 2-d CPR-Fano toric variety
|
|
442
|
+
covered by 4 affine patches
|
|
443
|
+
|
|
444
|
+
The quotient `\mathbb{P}^2 / \ZZ_3` over `GF(7)` by the diagonal
|
|
445
|
+
action. This is tricky because the base field has a 3-rd root of
|
|
446
|
+
unity::
|
|
447
|
+
|
|
448
|
+
sage: # needs polytopes_db
|
|
449
|
+
sage: fan = NormalFan(ReflexivePolytope(2, 0))
|
|
450
|
+
sage: X = ToricVariety(fan, base_field=GF(7))
|
|
451
|
+
sage: point_set = X.point_set()
|
|
452
|
+
sage: point_set.cardinality()
|
|
453
|
+
21
|
|
454
|
+
sage: sorted(X.point_set().list())
|
|
455
|
+
[[0 : 0 : 1], [0 : 1 : 0], [0 : 1 : 1], [0 : 1 : 3],
|
|
456
|
+
[1 : 0 : 0], [1 : 0 : 1], [1 : 0 : 3], [1 : 1 : 0],
|
|
457
|
+
[1 : 1 : 1], [1 : 1 : 2], [1 : 1 : 3], [1 : 1 : 4],
|
|
458
|
+
[1 : 1 : 5], [1 : 1 : 6], [1 : 3 : 0], [1 : 3 : 1],
|
|
459
|
+
[1 : 3 : 2], [1 : 3 : 3], [1 : 3 : 4], [1 : 3 : 5],
|
|
460
|
+
[1 : 3 : 6]]
|
|
461
|
+
|
|
462
|
+
As for a non-compact example, the blow-up of the plane is the line
|
|
463
|
+
bundle `O_{\mathbf{P}^1}(-1)`. Its point set is the Cartesian
|
|
464
|
+
product of the points on the base `\mathbf{P}^1` with the points
|
|
465
|
+
on the fiber::
|
|
466
|
+
|
|
467
|
+
sage: fan = Fan([Cone([(1,0), (1,1)]), Cone([(1,1), (0,1)])])
|
|
468
|
+
sage: blowup_plane = ToricVariety(fan, base_ring=GF(3))
|
|
469
|
+
sage: point_set = blowup_plane.point_set()
|
|
470
|
+
sage: sorted(point_set.list())
|
|
471
|
+
[[0 : 1 : 0], [0 : 1 : 1], [0 : 1 : 2],
|
|
472
|
+
[1 : 0 : 0], [1 : 0 : 1], [1 : 0 : 2],
|
|
473
|
+
[1 : 1 : 0], [1 : 1 : 1], [1 : 1 : 2],
|
|
474
|
+
[1 : 2 : 0], [1 : 2 : 1], [1 : 2 : 2]]
|
|
475
|
+
|
|
476
|
+
Toric varieties with torus factors (that is, where the fan is not
|
|
477
|
+
full-dimensional) also work::
|
|
478
|
+
|
|
479
|
+
sage: F_times_Fstar = ToricVariety(Fan([Cone([(1,0)])]), base_field=GF(3))
|
|
480
|
+
sage: sorted(F_times_Fstar.point_set().list())
|
|
481
|
+
[[0 : 1], [0 : 2], [1 : 1], [1 : 2], [2 : 1], [2 : 2]]
|
|
482
|
+
|
|
483
|
+
TESTS::
|
|
484
|
+
|
|
485
|
+
sage: import sage.schemes.toric.homset as HOM
|
|
486
|
+
sage: HOM.SchemeHomset_points_toric_field(Spec(QQ), P1xP1)
|
|
487
|
+
Set of rational points of 2-d CPR-Fano toric variety covered by 4 affine patches
|
|
488
|
+
"""
|
|
489
|
+
|
|
490
|
+
def cardinality(self):
|
|
491
|
+
r"""
|
|
492
|
+
Return the number of points of the toric variety.
|
|
493
|
+
|
|
494
|
+
OUTPUT: integer or infinity; the cardinality of the set of points
|
|
495
|
+
|
|
496
|
+
EXAMPLES::
|
|
497
|
+
|
|
498
|
+
sage: o = lattice_polytope.cross_polytope(3)
|
|
499
|
+
sage: V = ToricVariety(FaceFan(o))
|
|
500
|
+
sage: V.change_ring(GF(2)).point_set().cardinality()
|
|
501
|
+
27
|
|
502
|
+
sage: V.change_ring(GF(8, "a")).point_set().cardinality() # needs sage.rings.finite_rings
|
|
503
|
+
729
|
|
504
|
+
sage: V.change_ring(GF(101)).point_set().cardinality()
|
|
505
|
+
1061208
|
|
506
|
+
|
|
507
|
+
For non-smooth varieties over finite fields, the homogeneous
|
|
508
|
+
rescalings are solved. This is somewhat slower::
|
|
509
|
+
|
|
510
|
+
sage: # needs polytopes_db
|
|
511
|
+
sage: fan = NormalFan(ReflexivePolytope(2, 0))
|
|
512
|
+
sage: X = ToricVariety(fan, base_field=GF(7))
|
|
513
|
+
sage: X.point_set().cardinality()
|
|
514
|
+
21
|
|
515
|
+
|
|
516
|
+
Fulton's formula does not apply since the variety is not
|
|
517
|
+
smooth. And, indeed, naive application gives a different
|
|
518
|
+
result::
|
|
519
|
+
|
|
520
|
+
sage: # needs polytopes_db
|
|
521
|
+
sage: q = X.base_ring().order()
|
|
522
|
+
sage: n = X.dimension()
|
|
523
|
+
sage: d = map(len, fan().cones())
|
|
524
|
+
sage: sum(dk * (q-1)**(n-k) for k, dk in enumerate(d))
|
|
525
|
+
57
|
|
526
|
+
|
|
527
|
+
Over infinite fields the number of points is not very tricky::
|
|
528
|
+
|
|
529
|
+
sage: V.count_points()
|
|
530
|
+
+Infinity
|
|
531
|
+
|
|
532
|
+
ALGORITHM:
|
|
533
|
+
|
|
534
|
+
Uses the formula in Fulton [Ful1993]_, section 4.5.
|
|
535
|
+
|
|
536
|
+
AUTHORS:
|
|
537
|
+
|
|
538
|
+
- Beth Malmskog (2013-07-14)
|
|
539
|
+
|
|
540
|
+
- Adriana Salerno (2013-07-14)
|
|
541
|
+
|
|
542
|
+
- Yiwei She (2013-07-14)
|
|
543
|
+
|
|
544
|
+
- Christelle Vincent (2013-07-14)
|
|
545
|
+
|
|
546
|
+
- Ursula Whitcher (2013-07-14)
|
|
547
|
+
"""
|
|
548
|
+
variety = self.codomain()
|
|
549
|
+
if not variety.base_ring().is_finite():
|
|
550
|
+
if variety.dimension_relative() == 0:
|
|
551
|
+
return ZZ.one()
|
|
552
|
+
else:
|
|
553
|
+
from sage.rings.infinity import Infinity
|
|
554
|
+
return Infinity
|
|
555
|
+
if not variety.is_smooth():
|
|
556
|
+
try:
|
|
557
|
+
return self._enumerator().cardinality()
|
|
558
|
+
except AttributeError:
|
|
559
|
+
return super().cardinality()
|
|
560
|
+
q = variety.base_ring().order()
|
|
561
|
+
n = variety.dimension()
|
|
562
|
+
d = map(len, variety.fan().cones())
|
|
563
|
+
return sum(dk * (q - 1)**(n - k) for k, dk in enumerate(d))
|
|
564
|
+
|
|
565
|
+
def __iter__(self):
|
|
566
|
+
"""
|
|
567
|
+
Iterate over the points of the variety.
|
|
568
|
+
|
|
569
|
+
OUTPUT: iterator over points
|
|
570
|
+
|
|
571
|
+
EXAMPLES::
|
|
572
|
+
|
|
573
|
+
sage: P123 = toric_varieties.P2_123(base_ring=GF(3))
|
|
574
|
+
sage: point_set = P123.point_set()
|
|
575
|
+
sage: next(iter(point_set.__iter__()))
|
|
576
|
+
[0 : 0 : 1]
|
|
577
|
+
sage: next(iter(point_set)) # syntactic sugar
|
|
578
|
+
[0 : 0 : 1]
|
|
579
|
+
"""
|
|
580
|
+
for pt in self._enumerator():
|
|
581
|
+
yield self(pt)
|
|
582
|
+
|
|
583
|
+
|
|
584
|
+
class SchemeHomset_points_subscheme_toric_field(SchemeHomset_points_toric_base):
|
|
585
|
+
|
|
586
|
+
def _enumerator(self):
|
|
587
|
+
"""
|
|
588
|
+
Return the most suitable enumerator for points.
|
|
589
|
+
|
|
590
|
+
OUTPUT:
|
|
591
|
+
|
|
592
|
+
An iterable that yields the coordinates of all points as
|
|
593
|
+
tuples.
|
|
594
|
+
|
|
595
|
+
EXAMPLES::
|
|
596
|
+
|
|
597
|
+
sage: P123 = toric_varieties.P2_123(base_ring=GF(3))
|
|
598
|
+
sage: point_set = P123.point_set()
|
|
599
|
+
sage: point_set._enumerator()
|
|
600
|
+
<sage.schemes.toric.points.FiniteFieldPointEnumerator object at 0x...>
|
|
601
|
+
"""
|
|
602
|
+
ambient = super()._enumerator()
|
|
603
|
+
ring = self.domain().base_ring()
|
|
604
|
+
if ring in FiniteFields():
|
|
605
|
+
from sage.schemes.toric.points import FiniteFieldSubschemePointEnumerator
|
|
606
|
+
Enumerator = FiniteFieldSubschemePointEnumerator
|
|
607
|
+
else:
|
|
608
|
+
from sage.schemes.toric.points import NaiveSubschemePointEnumerator
|
|
609
|
+
Enumerator = NaiveSubschemePointEnumerator
|
|
610
|
+
return Enumerator(self.codomain().defining_polynomials(), ambient)
|
|
611
|
+
|
|
612
|
+
def __iter__(self):
|
|
613
|
+
"""
|
|
614
|
+
Iterate over the points of the variety.
|
|
615
|
+
|
|
616
|
+
OUTPUT: iterator over points
|
|
617
|
+
|
|
618
|
+
EXAMPLES::
|
|
619
|
+
|
|
620
|
+
sage: # needs sage.libs.singular
|
|
621
|
+
sage: P2.<x,y,z> = toric_varieties.P2(base_ring=GF(5))
|
|
622
|
+
sage: cubic = P2.subscheme([x^3 + y^3 + z^3])
|
|
623
|
+
sage: list(cubic.point_set())
|
|
624
|
+
[[0 : 1 : 4], [1 : 0 : 4], [1 : 4 : 0], [1 : 1 : 2], [1 : 2 : 1], [1 : 3 : 3]]
|
|
625
|
+
sage: cubic.point_set().cardinality()
|
|
626
|
+
6
|
|
627
|
+
"""
|
|
628
|
+
for p in self._enumerator():
|
|
629
|
+
yield self(p)
|
|
630
|
+
|
|
631
|
+
def cardinality(self):
|
|
632
|
+
"""
|
|
633
|
+
Return the number of points of the toric variety.
|
|
634
|
+
|
|
635
|
+
OUTPUT: integer or infinity; the cardinality of the set of points
|
|
636
|
+
|
|
637
|
+
EXAMPLES::
|
|
638
|
+
|
|
639
|
+
sage: # needs sage.libs.singular
|
|
640
|
+
sage: P2.<x,y,z> = toric_varieties.P2(base_ring=GF(5))
|
|
641
|
+
sage: cubic = P2.subscheme([x^3 + y^3 + z^3])
|
|
642
|
+
sage: list(cubic.point_set())
|
|
643
|
+
[[0 : 1 : 4], [1 : 0 : 4], [1 : 4 : 0], [1 : 1 : 2], [1 : 2 : 1], [1 : 3 : 3]]
|
|
644
|
+
sage: cubic.point_set().cardinality()
|
|
645
|
+
6
|
|
646
|
+
"""
|
|
647
|
+
try:
|
|
648
|
+
return self._enumerator().cardinality()
|
|
649
|
+
except AttributeError:
|
|
650
|
+
return super().cardinality()
|