passagemath-polyhedra 10.6.31rc3__cp314-cp314-macosx_13_0_arm64.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 +368 -0
- passagemath_polyhedra-10.6.31rc3.dist-info/METADATA.bak +371 -0
- passagemath_polyhedra-10.6.31rc3.dist-info/RECORD +205 -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.dylibs/libgmp.10.dylib +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-darwin.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-darwin.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-darwin.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-darwin.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-darwin.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-darwin.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-darwin.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-darwin.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-darwin.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-darwin.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-darwin.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-darwin.so +0 -0
- sage/numerical/backends/cvxopt_sdp_backend.pyx +382 -0
- sage/numerical/backends/cvxpy_backend.cpython-314-darwin.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-darwin.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-darwin.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-darwin.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-darwin.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-darwin.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-darwin.so +0 -0
- sage/numerical/linear_tensor_element.pxd +6 -0
- sage/numerical/linear_tensor_element.pyx +459 -0
- sage/numerical/mip.cpython-314-darwin.so +0 -0
- sage/numerical/mip.pxd +40 -0
- sage/numerical/mip.pyx +3667 -0
- sage/numerical/sdp.cpython-314-darwin.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-darwin.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
|
Binary file
|
|
@@ -0,0 +1,322 @@
|
|
|
1
|
+
# sage_setup: distribution = sagemath-polyhedra
|
|
2
|
+
# sage.doctest: needs sage.geometry.polyhedron sage.graphs
|
|
3
|
+
r"""
|
|
4
|
+
Toric rational divisor classes
|
|
5
|
+
|
|
6
|
+
This module is a part of the framework for :mod:`toric varieties
|
|
7
|
+
<sage.schemes.toric.variety>`.
|
|
8
|
+
|
|
9
|
+
AUTHORS:
|
|
10
|
+
|
|
11
|
+
- Volker Braun and Andrey Novoseltsev (2010-09-05): initial version.
|
|
12
|
+
|
|
13
|
+
TESTS:
|
|
14
|
+
|
|
15
|
+
Toric rational divisor classes are elements of the rational class group of a
|
|
16
|
+
toric variety, represented as rational vectors in some basis::
|
|
17
|
+
|
|
18
|
+
sage: dP6 = toric_varieties.dP6()
|
|
19
|
+
sage: Cl = dP6.rational_class_group()
|
|
20
|
+
sage: D = Cl([1, -2, 3, -4])
|
|
21
|
+
sage: D
|
|
22
|
+
Divisor class [1, -2, 3, -4]
|
|
23
|
+
sage: E = Cl([1/2, -2/3, 3/4, -4/5])
|
|
24
|
+
sage: E
|
|
25
|
+
Divisor class [1/2, -2/3, 3/4, -4/5]
|
|
26
|
+
|
|
27
|
+
They behave much like ordinary vectors::
|
|
28
|
+
|
|
29
|
+
sage: D + E
|
|
30
|
+
Divisor class [3/2, -8/3, 15/4, -24/5]
|
|
31
|
+
sage: 2 * D
|
|
32
|
+
Divisor class [2, -4, 6, -8]
|
|
33
|
+
sage: E / 10
|
|
34
|
+
Divisor class [1/20, -1/15, 3/40, -2/25]
|
|
35
|
+
sage: D * E
|
|
36
|
+
Traceback (most recent call last):
|
|
37
|
+
...
|
|
38
|
+
TypeError: cannot multiply two divisor classes
|
|
39
|
+
|
|
40
|
+
The only special method is :meth:`~ToricRationalDivisorClass.lift` to get a
|
|
41
|
+
divisor representing a divisor class::
|
|
42
|
+
|
|
43
|
+
sage: D.lift()
|
|
44
|
+
-3*V(x) - 9*V(u) + 7*V(z) + 3*V(w)
|
|
45
|
+
sage: E.lift()
|
|
46
|
+
-3/10*V(x) - 133/60*V(u) + 31/20*V(z) + 3/4*V(w)
|
|
47
|
+
"""
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
# ***************************************************************************
|
|
51
|
+
# Copyright (C) 2010 Volker Braun <vbraun.name@gmail.com>
|
|
52
|
+
# Copyright (C) 2010 Andrey Novoseltsev <novoselt@gmail.com>
|
|
53
|
+
# Copyright (C) 2010 William Stein <wstein@gmail.com>
|
|
54
|
+
#
|
|
55
|
+
# Distributed under the terms of the GNU General Public License (GPL)
|
|
56
|
+
#
|
|
57
|
+
# https://www.gnu.org/licenses/
|
|
58
|
+
# ***************************************************************************
|
|
59
|
+
|
|
60
|
+
from sage.libs.gmp.mpq cimport *
|
|
61
|
+
|
|
62
|
+
from sage.misc.latex import latex
|
|
63
|
+
from sage.modules.free_module_element import vector
|
|
64
|
+
from sage.modules.vector_rational_dense cimport Vector_rational_dense
|
|
65
|
+
from sage.rings.rational_field import QQ
|
|
66
|
+
from sage.rings.rational cimport Rational
|
|
67
|
+
from sage.structure.element cimport Vector
|
|
68
|
+
from sage.structure.element import Vector
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
def is_ToricRationalDivisorClass(x):
|
|
72
|
+
r"""
|
|
73
|
+
Check if ``x`` is a toric rational divisor class.
|
|
74
|
+
|
|
75
|
+
INPUT:
|
|
76
|
+
|
|
77
|
+
- ``x`` -- anything
|
|
78
|
+
|
|
79
|
+
OUTPUT: ``True`` if ``x`` is a toric rational divisor class, ``False`` otherwise
|
|
80
|
+
|
|
81
|
+
EXAMPLES::
|
|
82
|
+
|
|
83
|
+
sage: from sage.schemes.toric.divisor_class import is_ToricRationalDivisorClass
|
|
84
|
+
sage: is_ToricRationalDivisorClass(1)
|
|
85
|
+
False
|
|
86
|
+
sage: dP6 = toric_varieties.dP6()
|
|
87
|
+
sage: D = dP6.rational_class_group().gen(0); D
|
|
88
|
+
Divisor class [1, 0, 0, 0]
|
|
89
|
+
sage: is_ToricRationalDivisorClass(D)
|
|
90
|
+
True
|
|
91
|
+
"""
|
|
92
|
+
return isinstance(x, ToricRationalDivisorClass)
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
cdef class ToricRationalDivisorClass(Vector_rational_dense):
|
|
96
|
+
r"""
|
|
97
|
+
Create a toric rational divisor class.
|
|
98
|
+
|
|
99
|
+
.. WARNING::
|
|
100
|
+
|
|
101
|
+
You probably should not construct divisor classes explicitly.
|
|
102
|
+
|
|
103
|
+
INPUT:
|
|
104
|
+
|
|
105
|
+
- same as for
|
|
106
|
+
:class:`~sage.modules.vector_rational_dense.Vector_rational_dense`.
|
|
107
|
+
|
|
108
|
+
OUTPUT: toric rational divisor class
|
|
109
|
+
|
|
110
|
+
TESTS::
|
|
111
|
+
|
|
112
|
+
sage: dP6 = toric_varieties.dP6()
|
|
113
|
+
sage: Cl = dP6.rational_class_group()
|
|
114
|
+
sage: D = dP6.divisor(2)
|
|
115
|
+
sage: Cl(D)
|
|
116
|
+
Divisor class [0, 0, 1, 0]
|
|
117
|
+
"""
|
|
118
|
+
|
|
119
|
+
def __reduce__(self):
|
|
120
|
+
"""
|
|
121
|
+
Prepare ``self`` for pickling.
|
|
122
|
+
|
|
123
|
+
TESTS::
|
|
124
|
+
|
|
125
|
+
sage: dP6 = toric_varieties.dP6()
|
|
126
|
+
sage: Cl = dP6.rational_class_group()
|
|
127
|
+
sage: D = Cl([1, -2, 3, -4])
|
|
128
|
+
sage: D
|
|
129
|
+
Divisor class [1, -2, 3, -4]
|
|
130
|
+
sage: loads(dumps(D))
|
|
131
|
+
Divisor class [1, -2, 3, -4]
|
|
132
|
+
"""
|
|
133
|
+
return (_ToricRationalDivisorClass_unpickle_v1,
|
|
134
|
+
(self._parent, list(self), self._degree,
|
|
135
|
+
not self._is_immutable))
|
|
136
|
+
|
|
137
|
+
cpdef _act_on_(self, other, bint self_on_left):
|
|
138
|
+
"""
|
|
139
|
+
Act on ``other``.
|
|
140
|
+
|
|
141
|
+
INPUT:
|
|
142
|
+
|
|
143
|
+
- ``other`` -- something that
|
|
144
|
+
:class:`~sage.modules.vector_rational_dense.Vector_rational_dense`
|
|
145
|
+
can act on *except* for another toric rational divisor class.
|
|
146
|
+
|
|
147
|
+
OUTPUT:
|
|
148
|
+
|
|
149
|
+
- standard output for ``self`` acting as a rational vector on
|
|
150
|
+
``other`` if the latter one is not a toric rational divisor class.
|
|
151
|
+
|
|
152
|
+
TESTS::
|
|
153
|
+
|
|
154
|
+
sage: dP6 = toric_varieties.dP6()
|
|
155
|
+
sage: Cl = dP6.rational_class_group()
|
|
156
|
+
sage: D = Cl([1, -2, 3, -4])
|
|
157
|
+
sage: D
|
|
158
|
+
Divisor class [1, -2, 3, -4]
|
|
159
|
+
sage: D * D
|
|
160
|
+
Traceback (most recent call last):
|
|
161
|
+
...
|
|
162
|
+
TypeError: cannot multiply two divisor classes
|
|
163
|
+
|
|
164
|
+
We test standard behaviour::
|
|
165
|
+
|
|
166
|
+
sage: v = vector([1, 2, 3, 4])
|
|
167
|
+
sage: v * D # indirect doctest
|
|
168
|
+
-10
|
|
169
|
+
sage: D * v # indirect doctest
|
|
170
|
+
-10
|
|
171
|
+
sage: v = vector([1, 2/3, 4/5, 6/7])
|
|
172
|
+
sage: v * D # indirect doctest
|
|
173
|
+
-143/105
|
|
174
|
+
sage: D * v # indirect doctest
|
|
175
|
+
-143/105
|
|
176
|
+
sage: A = matrix(4, range(16))
|
|
177
|
+
sage: A * D # indirect doctest
|
|
178
|
+
(-8, -16, -24, -32)
|
|
179
|
+
sage: D * A # indirect doctest
|
|
180
|
+
(-32, -34, -36, -38)
|
|
181
|
+
sage: B = A / 3
|
|
182
|
+
sage: B * D # indirect doctest
|
|
183
|
+
(-8/3, -16/3, -8, -32/3)
|
|
184
|
+
sage: D * B # indirect doctest
|
|
185
|
+
(-32/3, -34/3, -12, -38/3)
|
|
186
|
+
"""
|
|
187
|
+
# If we don't treat vectors separately, they get converted into
|
|
188
|
+
# divisor classes where multiplication is prohibited on purpose.
|
|
189
|
+
if isinstance(other, Vector_rational_dense):
|
|
190
|
+
return Vector_rational_dense._dot_product_(self, other)
|
|
191
|
+
cdef Vector v
|
|
192
|
+
if isinstance(other, Vector) and not is_ToricRationalDivisorClass(other):
|
|
193
|
+
try:
|
|
194
|
+
v = vector(QQ, other)
|
|
195
|
+
if v._degree == self._degree:
|
|
196
|
+
return Vector_rational_dense._dot_product_(self, v)
|
|
197
|
+
except TypeError:
|
|
198
|
+
pass
|
|
199
|
+
# Now let the standard framework work...
|
|
200
|
+
return Vector_rational_dense._act_on_(self, other, self_on_left)
|
|
201
|
+
|
|
202
|
+
cpdef _dot_product_(self, Vector right):
|
|
203
|
+
r"""
|
|
204
|
+
Raise a :exc:`TypeError` exception.
|
|
205
|
+
|
|
206
|
+
Dot product is not defined on toric rational divisor classes.
|
|
207
|
+
|
|
208
|
+
INPUT:
|
|
209
|
+
|
|
210
|
+
- ``right`` -- vector
|
|
211
|
+
|
|
212
|
+
OUTPUT: a :exc:`TypeError` exception is raised
|
|
213
|
+
|
|
214
|
+
TESTS::
|
|
215
|
+
|
|
216
|
+
sage: c = toric_varieties.dP8().rational_class_group().gens()
|
|
217
|
+
sage: c[0]._dot_product_(c[1])
|
|
218
|
+
Traceback (most recent call last):
|
|
219
|
+
...
|
|
220
|
+
TypeError: cannot multiply two divisor classes
|
|
221
|
+
sage: c[0] * c[1] # indirect doctest
|
|
222
|
+
Traceback (most recent call last):
|
|
223
|
+
...
|
|
224
|
+
TypeError: cannot multiply two divisor classes
|
|
225
|
+
"""
|
|
226
|
+
raise TypeError("cannot multiply two divisor classes")
|
|
227
|
+
|
|
228
|
+
def _latex_(self):
|
|
229
|
+
r"""
|
|
230
|
+
Return a LaTeX representation of ``self``.
|
|
231
|
+
|
|
232
|
+
OUTPUT: string
|
|
233
|
+
|
|
234
|
+
TESTS::
|
|
235
|
+
|
|
236
|
+
sage: D = toric_varieties.dP6().divisor(0).divisor_class()
|
|
237
|
+
sage: print(D._latex_()) # needs polytopes_db
|
|
238
|
+
\left[ 1, 0, 0, 0 \right]_{\mathop{Cl}_{\QQ}\left(\mathbb{P}_{\Delta^{2}_{9}}\right)}
|
|
239
|
+
"""
|
|
240
|
+
return r"\left[ %s \right]_{%s}" % (
|
|
241
|
+
", ".join(latex(e) for e in self), latex(self.parent()))
|
|
242
|
+
|
|
243
|
+
def _repr_(self):
|
|
244
|
+
r"""
|
|
245
|
+
Return a string representation of ``self``.
|
|
246
|
+
|
|
247
|
+
OUTPUT: string
|
|
248
|
+
|
|
249
|
+
EXAMPLES::
|
|
250
|
+
|
|
251
|
+
sage: toric_varieties.dP6().divisor(0).divisor_class()._repr_()
|
|
252
|
+
'Divisor class [1, 0, 0, 0]'
|
|
253
|
+
"""
|
|
254
|
+
return 'Divisor class %s' % list(self)
|
|
255
|
+
|
|
256
|
+
def lift(self):
|
|
257
|
+
r"""
|
|
258
|
+
Return a divisor representing this divisor class.
|
|
259
|
+
|
|
260
|
+
OUTPUT: an instance of :class:`ToricDivisor` representing ``self``
|
|
261
|
+
|
|
262
|
+
EXAMPLES::
|
|
263
|
+
|
|
264
|
+
sage: X = toric_varieties.Cube_nonpolyhedral()
|
|
265
|
+
sage: D = X.divisor([0,1,2,3,4,5,6,7]); D
|
|
266
|
+
V(z1) + 2*V(z2) + 3*V(z3) + 4*V(z4) + 5*V(z5) + 6*V(z6) + 7*V(z7)
|
|
267
|
+
sage: D.divisor_class()
|
|
268
|
+
Divisor class [29, 6, 8, 10, 0]
|
|
269
|
+
sage: Dequiv = D.divisor_class().lift(); Dequiv
|
|
270
|
+
15*V(z1) - 11*V(z2) - 9*V(z5) + 19*V(z6) + 10*V(z7)
|
|
271
|
+
sage: Dequiv == D
|
|
272
|
+
False
|
|
273
|
+
sage: Dequiv.divisor_class() == D.divisor_class()
|
|
274
|
+
True
|
|
275
|
+
"""
|
|
276
|
+
Cl = self.parent()
|
|
277
|
+
return Cl._variety.divisor(Cl._lift_matrix * self)
|
|
278
|
+
|
|
279
|
+
|
|
280
|
+
def _ToricRationalDivisorClass_unpickle_v1(parent, entries,
|
|
281
|
+
degree, is_mutable):
|
|
282
|
+
"""
|
|
283
|
+
Unpickle a :class:`toric rational divisor class
|
|
284
|
+
<ToricRationalDivisorClass>`.
|
|
285
|
+
|
|
286
|
+
INPUT:
|
|
287
|
+
|
|
288
|
+
- ``parent`` -- rational divisor class group of a toric variety
|
|
289
|
+
|
|
290
|
+
- ``entries`` -- list of rationals specifying the divisor class
|
|
291
|
+
|
|
292
|
+
- ``degree`` -- integer; dimension of the ``parent``
|
|
293
|
+
|
|
294
|
+
- ``is_mutable`` -- boolean, whether the divisor class is mutable
|
|
295
|
+
|
|
296
|
+
OUTPUT: :class:`toric rational divisor class <ToricRationalDivisorClass>`
|
|
297
|
+
|
|
298
|
+
TESTS::
|
|
299
|
+
|
|
300
|
+
sage: dP6 = toric_varieties.dP6()
|
|
301
|
+
sage: Cl = dP6.rational_class_group()
|
|
302
|
+
sage: D = Cl([1, -2, 3, -4])
|
|
303
|
+
sage: D
|
|
304
|
+
Divisor class [1, -2, 3, -4]
|
|
305
|
+
sage: loads(dumps(D)) # indirect test
|
|
306
|
+
Divisor class [1, -2, 3, -4]
|
|
307
|
+
sage: from sage.schemes.toric.divisor_class import (
|
|
308
|
+
....: _ToricRationalDivisorClass_unpickle_v1)
|
|
309
|
+
sage: _ToricRationalDivisorClass_unpickle_v1(
|
|
310
|
+
....: Cl, [1, -2, 3, -4], 4, True)
|
|
311
|
+
Divisor class [1, -2, 3, -4]
|
|
312
|
+
"""
|
|
313
|
+
cdef ToricRationalDivisorClass v
|
|
314
|
+
v = ToricRationalDivisorClass.__new__(ToricRationalDivisorClass)
|
|
315
|
+
v._init(degree, parent)
|
|
316
|
+
cdef Rational z
|
|
317
|
+
cdef Py_ssize_t i
|
|
318
|
+
for i in range(degree):
|
|
319
|
+
z = Rational(entries[i])
|
|
320
|
+
mpq_set(v._entries[i], z.value)
|
|
321
|
+
v._is_immutable = not is_mutable
|
|
322
|
+
return v
|