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.
- 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 +208 -0
- passagemath_polyhedra-10.6.31rc3.dist-info/WHEEL +5 -0
- passagemath_polyhedra-10.6.31rc3.dist-info/top_level.txt +2 -0
- passagemath_polyhedra.libs/libgcc_s-0cd532bd.so.1 +0 -0
- passagemath_polyhedra.libs/libgmp-0e7fc84e.so.10.5.0 +0 -0
- passagemath_polyhedra.libs/libgomp-8949ffbe.so.1.0.0 +0 -0
- passagemath_polyhedra.libs/libstdc++-5d72f927.so.6.0.33 +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-musl.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-musl.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-musl.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-musl.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-musl.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-musl.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-musl.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-musl.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-musl.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-musl.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-musl.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-musl.so +0 -0
- sage/numerical/backends/cvxopt_sdp_backend.pyx +382 -0
- sage/numerical/backends/cvxpy_backend.cpython-314-x86_64-linux-musl.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-musl.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-musl.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-musl.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-musl.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-musl.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-musl.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-musl.so +0 -0
- sage/numerical/mip.pxd +40 -0
- sage/numerical/mip.pyx +3667 -0
- sage/numerical/sdp.cpython-314-x86_64-linux-musl.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-musl.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,231 @@
|
|
|
1
|
+
# sage_setup: distribution = sagemath-polyhedra
|
|
2
|
+
# sage.doctest: needs cddexec_gmp sage.rings.real_double
|
|
3
|
+
|
|
4
|
+
r"""
|
|
5
|
+
The cdd backend for polyhedral computations, floating point version
|
|
6
|
+
"""
|
|
7
|
+
# ****************************************************************************
|
|
8
|
+
# Copyright (C) 2011-2014 Volker Braun <vbraun.name@gmail.com>
|
|
9
|
+
# 2018 Timo Kaufmann <timokau@zoho.com>
|
|
10
|
+
# 2018 Julian Rüth <julian.rueth@fsfe.org>
|
|
11
|
+
#
|
|
12
|
+
# This program is free software: you can redistribute it and/or modify
|
|
13
|
+
# it under the terms of the GNU General Public License as published by
|
|
14
|
+
# the Free Software Foundation, either version 2 of the License, or
|
|
15
|
+
# (at your option) any later version.
|
|
16
|
+
# https://www.gnu.org/licenses/
|
|
17
|
+
# ****************************************************************************
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
from .backend_cdd import Polyhedron_cdd
|
|
21
|
+
from .base_RDF import Polyhedron_RDF
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class Polyhedron_RDF_cdd(Polyhedron_cdd, Polyhedron_RDF):
|
|
25
|
+
"""
|
|
26
|
+
Polyhedra over RDF with cdd.
|
|
27
|
+
|
|
28
|
+
INPUT:
|
|
29
|
+
|
|
30
|
+
- ``ambient_dim`` -- integer; the dimension of the ambient space
|
|
31
|
+
|
|
32
|
+
- ``Vrep`` -- list ``[vertices, rays, lines]`` or ``None``
|
|
33
|
+
|
|
34
|
+
- ``Hrep`` -- list ``[ieqs, eqns]`` or ``None``
|
|
35
|
+
|
|
36
|
+
EXAMPLES::
|
|
37
|
+
|
|
38
|
+
sage: from sage.geometry.polyhedron.parent import Polyhedra
|
|
39
|
+
sage: parent = Polyhedra(RDF, 2, backend='cdd')
|
|
40
|
+
sage: from sage.geometry.polyhedron.backend_cdd_rdf import Polyhedron_RDF_cdd
|
|
41
|
+
sage: Polyhedron_RDF_cdd(parent, [ [(1,0),(0,1),(0,0)], [], []], None, verbose=False)
|
|
42
|
+
A 2-dimensional polyhedron in RDF^2 defined as the convex hull of 3 vertices
|
|
43
|
+
|
|
44
|
+
TESTS:
|
|
45
|
+
|
|
46
|
+
Checks that :issue:`24877` is fixed::
|
|
47
|
+
|
|
48
|
+
sage: n1 = 1045602428815736513789288687833080060779
|
|
49
|
+
sage: n2 = 76591188009721216624438400001815308369088648782156930777145
|
|
50
|
+
sage: n3 = 141046287872967162025203834781636948939209065735662536571684677443277621519222367249160281646288602157866548267640061850035
|
|
51
|
+
sage: n4 = 169296796161110084211548448622149955145002732358082778064645608216077666698460018565094060494217
|
|
52
|
+
sage: verts = [[159852/261157, 227425/261157],
|
|
53
|
+
....: [9/10, 7/10],
|
|
54
|
+
....: [132/179, 143/179],
|
|
55
|
+
....: [8/11, -59/33],
|
|
56
|
+
....: [174/167, 95/167],
|
|
57
|
+
....: [3/2, -1/2],
|
|
58
|
+
....: [-1162016360399650274197433414376009691155/n1,
|
|
59
|
+
....: 1626522696050475596930360993440360903664/n1],
|
|
60
|
+
....: [-112565666321600055047037445519656973805313121630809713051718/n2,
|
|
61
|
+
....: -15318574020578896781701071673537253327221557273483622682053/n2],
|
|
62
|
+
....: [-222823992658914823798345935660863293259608796350232624336738123149601409997996952470726909468671437285720616325991022633438/n3,
|
|
63
|
+
....: (-20857694835570598502487921801401627779907095024585170129381924208334510445828894861553290291713792691651471189597832832973*5)/n3],
|
|
64
|
+
....: [-100432602675156818915933977983765863676402454634873648118147187022041830166292457614016362515164/n4,
|
|
65
|
+
....: -429364759737031049317769174492863890735634068814210512342503744054527903830844433491149538512537/n4]]
|
|
66
|
+
sage: P = Polyhedron(verts, base_ring=RDF)
|
|
67
|
+
sage: len(P.faces(1))
|
|
68
|
+
10
|
|
69
|
+
sage: P.n_vertices()
|
|
70
|
+
10
|
|
71
|
+
sage: P.n_facets()
|
|
72
|
+
10
|
|
73
|
+
|
|
74
|
+
Check that :issue:`19803` is fixed::
|
|
75
|
+
|
|
76
|
+
sage: from sage.geometry.polyhedron.parent import Polyhedra
|
|
77
|
+
sage: P_cdd = Polyhedra(RDF, 3, 'cdd')
|
|
78
|
+
sage: P_cdd([[],[],[]], None)
|
|
79
|
+
The empty polyhedron in RDF^3
|
|
80
|
+
sage: Polyhedron(vertices=[], backend='cdd', base_ring=RDF)
|
|
81
|
+
The empty polyhedron in RDF^0
|
|
82
|
+
"""
|
|
83
|
+
_cdd_type = 'real'
|
|
84
|
+
|
|
85
|
+
_cdd_executable = 'cddexec'
|
|
86
|
+
|
|
87
|
+
def __init__(self, parent, Vrep, Hrep, **kwds):
|
|
88
|
+
"""
|
|
89
|
+
The Python constructor.
|
|
90
|
+
|
|
91
|
+
See :class:`Polyhedron_base` for a description of the input
|
|
92
|
+
data.
|
|
93
|
+
|
|
94
|
+
TESTS::
|
|
95
|
+
|
|
96
|
+
sage: p = Polyhedron(backend='cdd', base_ring=RDF)
|
|
97
|
+
sage: type(p)
|
|
98
|
+
<class 'sage.geometry.polyhedron.parent.Polyhedra_RDF_cdd_with_category.element_class'>
|
|
99
|
+
sage: TestSuite(p).run()
|
|
100
|
+
"""
|
|
101
|
+
Polyhedron_cdd.__init__(self, parent, Vrep, Hrep, **kwds)
|
|
102
|
+
|
|
103
|
+
def _init_from_Vrepresentation_and_Hrepresentation(self, Vrep, Hrep, verbose=False):
|
|
104
|
+
"""
|
|
105
|
+
Construct polyhedron from Vrepresentation and Hrepresentation data.
|
|
106
|
+
|
|
107
|
+
See :class:`Polyhedron_base` for a description of ``Vrep`` and ``Hrep``.
|
|
108
|
+
|
|
109
|
+
.. NOTE::
|
|
110
|
+
|
|
111
|
+
The representation is assumed to be correct.
|
|
112
|
+
|
|
113
|
+
As long as cdd can obtain a consistent object with Vrepresentation
|
|
114
|
+
or Hrepresentation no warning is raised. Consistency is checked by
|
|
115
|
+
comparing the output length of Vrepresentation and Hrepresentation
|
|
116
|
+
with the input.
|
|
117
|
+
|
|
118
|
+
In comparison, the "normal" initialization from Vrepresentation over RDF
|
|
119
|
+
expects the output length to be consistent with the computed length
|
|
120
|
+
when re-feeding cdd the outputted Hrepresentation.
|
|
121
|
+
|
|
122
|
+
EXAMPLES::
|
|
123
|
+
|
|
124
|
+
sage: from sage.geometry.polyhedron.parent import Polyhedra_RDF_cdd
|
|
125
|
+
sage: from sage.geometry.polyhedron.backend_cdd_rdf import Polyhedron_RDF_cdd
|
|
126
|
+
sage: parent = Polyhedra_RDF_cdd(RDF, 1, 'cdd')
|
|
127
|
+
sage: Vrep = [[[0.0], [1.0]], [], []]
|
|
128
|
+
sage: Hrep = [[[0.0, 1.0], [1.0, -1.0]], []]
|
|
129
|
+
sage: p = Polyhedron_RDF_cdd(parent, Vrep, Hrep, # indirect doctest
|
|
130
|
+
....: Vrep_minimal=True, Hrep_minimal=True)
|
|
131
|
+
sage: p
|
|
132
|
+
A 1-dimensional polyhedron in RDF^1 defined as the convex hull of 2 vertices
|
|
133
|
+
|
|
134
|
+
TESTS:
|
|
135
|
+
|
|
136
|
+
Test that :issue:`29568` is fixed::
|
|
137
|
+
|
|
138
|
+
sage: # needs sage.groups
|
|
139
|
+
sage: P = polytopes.buckyball(exact=False)
|
|
140
|
+
sage: Q = P + P.center()
|
|
141
|
+
sage: P.is_combinatorially_isomorphic(Q)
|
|
142
|
+
True
|
|
143
|
+
sage: R = 2*P
|
|
144
|
+
sage: P.is_combinatorially_isomorphic(R)
|
|
145
|
+
True
|
|
146
|
+
|
|
147
|
+
The polyhedron with zero inequalities works correctly; see :issue:`29899`::
|
|
148
|
+
|
|
149
|
+
sage: Vrep = [[], [], [[1.0]]]
|
|
150
|
+
sage: Hrep = [[], []]
|
|
151
|
+
sage: p = Polyhedron_RDF_cdd(parent, Vrep, Hrep, # indirect doctest
|
|
152
|
+
....: Vrep_minimal=True, Hrep_minimal=True)
|
|
153
|
+
sage: p
|
|
154
|
+
A 1-dimensional polyhedron in RDF^1 defined as the convex hull of 1 vertex and 1 line
|
|
155
|
+
|
|
156
|
+
Test that :issue:`30330` is fixed::
|
|
157
|
+
|
|
158
|
+
sage: P1 = polytopes.regular_polygon(5, exact=False)
|
|
159
|
+
sage: P2 = Polyhedron()
|
|
160
|
+
sage: P1*P2
|
|
161
|
+
The empty polyhedron in RDF^2
|
|
162
|
+
"""
|
|
163
|
+
def parse_Vrep(intro, data):
|
|
164
|
+
count = int(data[0][0])
|
|
165
|
+
if count != len(vertices) + len(rays) + len(lines):
|
|
166
|
+
# Upstream claims that nothing can be done about these
|
|
167
|
+
# cases/that they are features not bugs. Imho, cddlib is
|
|
168
|
+
# not really suitable for automatic parsing of its output,
|
|
169
|
+
# the implementation backed by doubles has not really been
|
|
170
|
+
# optimized for numerical stability, and makes some
|
|
171
|
+
# somewhat random numerical choices. (But I am not an
|
|
172
|
+
# expert in that field by any means.) See also
|
|
173
|
+
# https://github.com/cddlib/cddlib/pull/7.
|
|
174
|
+
from warnings import warn
|
|
175
|
+
warn("This polyhedron data is numerically complicated; cdd could not convert between the inexact V and H representation without loss of data. The resulting object might show inconsistencies.")
|
|
176
|
+
|
|
177
|
+
def parse_Hrep(intro, data):
|
|
178
|
+
count = int(data[0][0])
|
|
179
|
+
infinite_count = len([d for d in data[1:] if d[0] == '1' and all(c == '0' for c in d[1:])])
|
|
180
|
+
if count - infinite_count != len(ieqs) + len(eqns):
|
|
181
|
+
# Upstream claims that nothing can be done about these
|
|
182
|
+
# cases/that they are features not bugs. Imho, cddlib is
|
|
183
|
+
# not really suitable for automatic parsing of its output,
|
|
184
|
+
# the implementation backed by doubles has not really been
|
|
185
|
+
# optimized for numerical stability, and makes some
|
|
186
|
+
# somewhat random numerical choices. (But I am not an
|
|
187
|
+
# expert in that field by any means.)
|
|
188
|
+
from warnings import warn
|
|
189
|
+
warn("This polyhedron data is numerically complicated; cdd could not convert between the inexact V and H representation without loss of data. The resulting object might show inconsistencies.")
|
|
190
|
+
|
|
191
|
+
def try_init(rep):
|
|
192
|
+
if rep == "Vrep":
|
|
193
|
+
from .cdd_file_format import cdd_Vrepresentation
|
|
194
|
+
s = cdd_Vrepresentation(self._cdd_type, vertices, rays, lines)
|
|
195
|
+
else:
|
|
196
|
+
# We have to add a trivial inequality, in case the polyhedron is the universe.
|
|
197
|
+
new_ieqs = ieqs + ((1,) + tuple(0 for _ in range(self.ambient_dim())),)
|
|
198
|
+
|
|
199
|
+
from .cdd_file_format import cdd_Hrepresentation
|
|
200
|
+
s = cdd_Hrepresentation(self._cdd_type, new_ieqs, eqns)
|
|
201
|
+
|
|
202
|
+
s = self._run_cdd(s, '--redcheck', verbose=verbose)
|
|
203
|
+
s = self._run_cdd(s, '--repall', verbose=verbose)
|
|
204
|
+
Polyhedron_cdd._parse_block(s.splitlines(), 'V-representation', parse_Vrep)
|
|
205
|
+
Polyhedron_cdd._parse_block(s.splitlines(), 'H-representation', parse_Hrep)
|
|
206
|
+
self._init_from_cdd_output(s)
|
|
207
|
+
|
|
208
|
+
from warnings import catch_warnings, simplefilter
|
|
209
|
+
|
|
210
|
+
vertices, rays, lines = (tuple(x) for x in Vrep)
|
|
211
|
+
ieqs, eqns = (tuple(x) for x in Hrep)
|
|
212
|
+
|
|
213
|
+
if not (vertices or rays or lines):
|
|
214
|
+
# cdd refuses to handle empty polyhedra.
|
|
215
|
+
self._init_empty_polyhedron()
|
|
216
|
+
return
|
|
217
|
+
|
|
218
|
+
# We prefer the shorter representation.
|
|
219
|
+
# Note that for the empty polyhedron we prefer Hrepresentation.
|
|
220
|
+
prim = "Hrep" if len(ieqs) <= len(vertices) + len(rays) else "Vrep"
|
|
221
|
+
sec = "Vrep" if len(ieqs) <= len(vertices) + len(rays) else "Hrep"
|
|
222
|
+
|
|
223
|
+
with catch_warnings():
|
|
224
|
+
# Raise an error and try the other representation in case of
|
|
225
|
+
# numerical inconsistency.
|
|
226
|
+
simplefilter("error")
|
|
227
|
+
try:
|
|
228
|
+
try_init(prim)
|
|
229
|
+
except UserWarning:
|
|
230
|
+
simplefilter("once") # Only print the first warning.
|
|
231
|
+
try_init(sec)
|
|
@@ -0,0 +1,347 @@
|
|
|
1
|
+
# sage_setup: distribution = sagemath-polyhedra
|
|
2
|
+
"""
|
|
3
|
+
The Python backend
|
|
4
|
+
|
|
5
|
+
While slower than specialized C/C++ implementations, the
|
|
6
|
+
implementation is general and works with any exact field in Sage that
|
|
7
|
+
allows you to define polyhedra.
|
|
8
|
+
|
|
9
|
+
EXAMPLES::
|
|
10
|
+
|
|
11
|
+
sage: # needs sage.rings.number_field
|
|
12
|
+
sage: p0 = (0, 0)
|
|
13
|
+
sage: p1 = (1, 0)
|
|
14
|
+
sage: p2 = (1/2, AA(3).sqrt()/2)
|
|
15
|
+
sage: equilateral_triangle = Polyhedron([p0, p1, p2])
|
|
16
|
+
sage: equilateral_triangle.vertices()
|
|
17
|
+
(A vertex at (0, 0),
|
|
18
|
+
A vertex at (1, 0),
|
|
19
|
+
A vertex at (0.500000000000000?, 0.866025403784439?))
|
|
20
|
+
sage: equilateral_triangle.inequalities()
|
|
21
|
+
(An inequality (-1, -0.5773502691896258?) x + 1 >= 0,
|
|
22
|
+
An inequality (1, -0.5773502691896258?) x + 0 >= 0,
|
|
23
|
+
An inequality (0, 1.154700538379252?) x + 0 >= 0)
|
|
24
|
+
"""
|
|
25
|
+
#*****************************************************************************
|
|
26
|
+
# Copyright (C) 2014 Volker Braun <vbraun.name@gmail.com>
|
|
27
|
+
#
|
|
28
|
+
# This program is free software: you can redistribute it and/or modify
|
|
29
|
+
# it under the terms of the GNU General Public License as published by
|
|
30
|
+
# the Free Software Foundation, either version 2 of the License, or
|
|
31
|
+
# (at your option) any later version.
|
|
32
|
+
# http://www.gnu.org/licenses/
|
|
33
|
+
#*****************************************************************************
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
from .base import Polyhedron_base
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
class Polyhedron_field(Polyhedron_base):
|
|
40
|
+
"""
|
|
41
|
+
Polyhedra over all fields supported by Sage.
|
|
42
|
+
|
|
43
|
+
INPUT:
|
|
44
|
+
|
|
45
|
+
- ``Vrep`` -- list ``[vertices, rays, lines]`` or ``None``
|
|
46
|
+
|
|
47
|
+
- ``Hrep`` -- list ``[ieqs, eqns]`` or ``None``
|
|
48
|
+
|
|
49
|
+
EXAMPLES::
|
|
50
|
+
|
|
51
|
+
sage: p = Polyhedron(vertices=[(0,0),(AA(2).sqrt(),0),(0,AA(3).sqrt())], # needs sage.rings.number_field
|
|
52
|
+
....: rays=[(1,1)], lines=[], backend='field', base_ring=AA)
|
|
53
|
+
sage: TestSuite(p).run() # needs sage.rings.number_field
|
|
54
|
+
|
|
55
|
+
TESTS::
|
|
56
|
+
|
|
57
|
+
sage: K.<sqrt3> = QuadraticField(3) # needs sage.rings.number_field
|
|
58
|
+
sage: p = Polyhedron([(0,0), (1,0), (1/2, sqrt3/2)]) # needs sage.rings.number_field
|
|
59
|
+
sage: TestSuite(p).run() # needs sage.rings.number_field
|
|
60
|
+
|
|
61
|
+
Check that :issue:`19013` is fixed::
|
|
62
|
+
|
|
63
|
+
sage: # needs sage.rings.number_field
|
|
64
|
+
sage: x = polygen(ZZ, 'x')
|
|
65
|
+
sage: K.<phi> = NumberField(x^2 - x - 1, embedding=1.618)
|
|
66
|
+
sage: P1 = Polyhedron([[0,1], [1,1], [1,-phi+1]])
|
|
67
|
+
sage: P2 = Polyhedron(ieqs=[[-1,-phi,0]])
|
|
68
|
+
sage: P1.intersection(P2)
|
|
69
|
+
The empty polyhedron
|
|
70
|
+
in (Number Field in phi with defining polynomial x^2 - x - 1 with phi = 1.618033988749895?)^2
|
|
71
|
+
|
|
72
|
+
Check that :issue:`28654` is fixed::
|
|
73
|
+
|
|
74
|
+
sage: Polyhedron(lines=[[1]], backend='field')
|
|
75
|
+
A 1-dimensional polyhedron in QQ^1 defined as the convex hull of 1 vertex and 1 line
|
|
76
|
+
"""
|
|
77
|
+
def _is_zero(self, x):
|
|
78
|
+
"""
|
|
79
|
+
Test whether ``x`` is zero.
|
|
80
|
+
|
|
81
|
+
INPUT:
|
|
82
|
+
|
|
83
|
+
- ``x`` -- a number in the base ring
|
|
84
|
+
|
|
85
|
+
OUTPUT: boolean
|
|
86
|
+
|
|
87
|
+
EXAMPLES::
|
|
88
|
+
|
|
89
|
+
sage: p = Polyhedron([(sqrt(3),sqrt(2))], base_ring=AA) # needs sage.rings.number_field sage.symbolic
|
|
90
|
+
sage: p._is_zero(0) # needs sage.rings.number_field sage.symbolic
|
|
91
|
+
True
|
|
92
|
+
sage: p._is_zero(1/100000) # needs sage.rings.number_field sage.symbolic
|
|
93
|
+
False
|
|
94
|
+
"""
|
|
95
|
+
return x == 0
|
|
96
|
+
|
|
97
|
+
def _is_nonneg(self, x):
|
|
98
|
+
"""
|
|
99
|
+
Test whether ``x`` is nonnegative.
|
|
100
|
+
|
|
101
|
+
INPUT:
|
|
102
|
+
|
|
103
|
+
- ``x`` -- a number in the base ring
|
|
104
|
+
|
|
105
|
+
OUTPUT: boolean
|
|
106
|
+
|
|
107
|
+
EXAMPLES::
|
|
108
|
+
|
|
109
|
+
sage: p = Polyhedron([(sqrt(3),sqrt(2))], base_ring=AA) # needs sage.rings.number_field sage.symbolic
|
|
110
|
+
sage: p._is_nonneg(1) # needs sage.rings.number_field sage.symbolic
|
|
111
|
+
True
|
|
112
|
+
sage: p._is_nonneg(-1/100000) # needs sage.rings.number_field sage.symbolic
|
|
113
|
+
False
|
|
114
|
+
"""
|
|
115
|
+
return x >= 0
|
|
116
|
+
|
|
117
|
+
def _is_positive(self, x):
|
|
118
|
+
"""
|
|
119
|
+
Test whether ``x`` is positive.
|
|
120
|
+
|
|
121
|
+
INPUT:
|
|
122
|
+
|
|
123
|
+
- ``x`` -- a number in the base ring
|
|
124
|
+
|
|
125
|
+
OUTPUT: boolean
|
|
126
|
+
|
|
127
|
+
EXAMPLES::
|
|
128
|
+
|
|
129
|
+
sage: p = Polyhedron([(sqrt(3),sqrt(2))], base_ring=AA) # needs sage.rings.number_field sage.symbolic
|
|
130
|
+
sage: p._is_positive(1) # needs sage.rings.number_field sage.symbolic
|
|
131
|
+
True
|
|
132
|
+
sage: p._is_positive(0) # needs sage.rings.number_field sage.symbolic
|
|
133
|
+
False
|
|
134
|
+
"""
|
|
135
|
+
return x > 0
|
|
136
|
+
|
|
137
|
+
def _init_from_Vrepresentation_and_Hrepresentation(self, Vrep, Hrep):
|
|
138
|
+
"""
|
|
139
|
+
Construct polyhedron from V-representation and H-representation data.
|
|
140
|
+
|
|
141
|
+
See :class:`Polyhedron_base` for a description of ``Vrep`` and ``Hrep``.
|
|
142
|
+
|
|
143
|
+
.. WARNING::
|
|
144
|
+
|
|
145
|
+
The representation is assumed to be correct.
|
|
146
|
+
It is not checked.
|
|
147
|
+
|
|
148
|
+
EXAMPLES::
|
|
149
|
+
|
|
150
|
+
sage: from sage.geometry.polyhedron.parent import Polyhedra_field
|
|
151
|
+
sage: from sage.geometry.polyhedron.backend_field import Polyhedron_field
|
|
152
|
+
sage: parent = Polyhedra_field(AA, 1, 'field') # needs sage.rings.number_field
|
|
153
|
+
sage: Vrep = [[[0], [1]], [], []]
|
|
154
|
+
sage: Hrep = [[[0, 1], [1, -1]], []]
|
|
155
|
+
sage: p = Polyhedron_field(parent, Vrep, Hrep, # indirect doctest # needs sage.rings.number_field
|
|
156
|
+
....: Vrep_minimal=True, Hrep_minimal=True)
|
|
157
|
+
sage: p # needs sage.rings.number_field
|
|
158
|
+
A 1-dimensional polyhedron in AA^1 defined as the convex hull of 2 vertices
|
|
159
|
+
"""
|
|
160
|
+
self._init_Vrepresentation(*Vrep)
|
|
161
|
+
self._init_Hrepresentation(*Hrep)
|
|
162
|
+
|
|
163
|
+
def _init_from_Vrepresentation(self, vertices, rays, lines,
|
|
164
|
+
minimize=True, verbose=False,
|
|
165
|
+
internal_base_ring=None):
|
|
166
|
+
"""
|
|
167
|
+
Construct polyhedron from V-representation data.
|
|
168
|
+
|
|
169
|
+
INPUT:
|
|
170
|
+
|
|
171
|
+
- ``vertices`` -- list of points; each point can be specified
|
|
172
|
+
as any iterable container of ``internal_base_ring`` elements
|
|
173
|
+
|
|
174
|
+
- ``rays`` -- list of rays; each ray can be specified as any
|
|
175
|
+
iterable container of ``internal_base_ring`` elements
|
|
176
|
+
|
|
177
|
+
- ``lines`` -- list of lines; each line can be specified asinternal_base_ring
|
|
178
|
+
any iterable container of ``internal_base_ring`` elements
|
|
179
|
+
|
|
180
|
+
- ``verbose`` -- boolean (default: ``False``); whether to print
|
|
181
|
+
verbose output for debugging purposes
|
|
182
|
+
|
|
183
|
+
- ``internal_base_ring`` -- the base ring of the generators' components;
|
|
184
|
+
default is ``None``, in which case, it is set to
|
|
185
|
+
:meth:`~sage.geometry.polyhedron.base.base_ring`
|
|
186
|
+
|
|
187
|
+
EXAMPLES::
|
|
188
|
+
|
|
189
|
+
sage: p = Polyhedron(ambient_dim=2, backend='field')
|
|
190
|
+
sage: from sage.geometry.polyhedron.backend_field import Polyhedron_field
|
|
191
|
+
sage: Polyhedron_field._init_from_Vrepresentation(p, [(0,0)], [], [])
|
|
192
|
+
"""
|
|
193
|
+
if internal_base_ring is None:
|
|
194
|
+
internal_base_ring = self.base_ring()
|
|
195
|
+
from sage.geometry.polyhedron.double_description_inhomogeneous import Hrep2Vrep, Vrep2Hrep
|
|
196
|
+
H = Vrep2Hrep(internal_base_ring, self.ambient_dim(), vertices, rays, lines)
|
|
197
|
+
V = Hrep2Vrep(internal_base_ring, self.ambient_dim(),
|
|
198
|
+
H.inequalities, H.equations)
|
|
199
|
+
self._init_Vrepresentation_backend(V)
|
|
200
|
+
self._init_Hrepresentation_backend(H)
|
|
201
|
+
|
|
202
|
+
def _init_from_Hrepresentation(self, ieqs, eqns,
|
|
203
|
+
minimize=True, verbose=False,
|
|
204
|
+
internal_base_ring=None):
|
|
205
|
+
"""
|
|
206
|
+
Construct polyhedron from H-representation data.
|
|
207
|
+
|
|
208
|
+
INPUT:
|
|
209
|
+
|
|
210
|
+
- ``ieqs`` -- list of inequalities; each line can be specified
|
|
211
|
+
as any iterable container of ``internal_base_ring`` elements
|
|
212
|
+
|
|
213
|
+
- ``eqns`` -- list of equalities; each line can be specified
|
|
214
|
+
as any iterable container of ``internal_base_ring`` elements
|
|
215
|
+
|
|
216
|
+
- ``verbose`` -- boolean (default: ``False``); whether to print
|
|
217
|
+
verbose output for debugging purposes
|
|
218
|
+
|
|
219
|
+
- ``internal_base_ring`` -- the base ring of the generators' components;
|
|
220
|
+
default is ``None``, in which case, it is set to
|
|
221
|
+
:meth:`~sage.geometry.polyhedron.base.base_ring`
|
|
222
|
+
|
|
223
|
+
TESTS::
|
|
224
|
+
|
|
225
|
+
sage: p = Polyhedron(ambient_dim=2, backend='field')
|
|
226
|
+
sage: from sage.geometry.polyhedron.backend_field import Polyhedron_field
|
|
227
|
+
sage: Polyhedron_field._init_from_Hrepresentation(p, [(1, 2, 3)], [])
|
|
228
|
+
"""
|
|
229
|
+
if internal_base_ring is None:
|
|
230
|
+
internal_base_ring = self.base_ring()
|
|
231
|
+
from sage.geometry.polyhedron.double_description_inhomogeneous import Hrep2Vrep, Vrep2Hrep
|
|
232
|
+
V = Hrep2Vrep(internal_base_ring, self.ambient_dim(), ieqs, eqns)
|
|
233
|
+
H = Vrep2Hrep(internal_base_ring, self.ambient_dim(),
|
|
234
|
+
V.vertices, V.rays, V.lines)
|
|
235
|
+
self._init_Vrepresentation_backend(V)
|
|
236
|
+
self._init_Hrepresentation_backend(H)
|
|
237
|
+
|
|
238
|
+
def _init_Vrepresentation(self, vertices, rays, lines):
|
|
239
|
+
"""
|
|
240
|
+
Create the Vrepresentation objects from the given minimal data.
|
|
241
|
+
|
|
242
|
+
EXAMPLES::
|
|
243
|
+
|
|
244
|
+
sage: from sage.geometry.polyhedron.parent import Polyhedra_field
|
|
245
|
+
sage: from sage.geometry.polyhedron.backend_field import Polyhedron_field
|
|
246
|
+
sage: parent = Polyhedra_field(AA, 1, 'field') # needs sage.rings.number_field
|
|
247
|
+
sage: Vrep = [[[0], [1]], [], []]
|
|
248
|
+
sage: Hrep = [[[0, 1], [1, -1]], []]
|
|
249
|
+
sage: p = Polyhedron_field(parent, Vrep, Hrep, # indirect doctest # needs sage.rings.number_field
|
|
250
|
+
....: Vrep_minimal=True,
|
|
251
|
+
....: Hrep_minimal=True)
|
|
252
|
+
sage: p.vertices_list() # needs sage.rings.number_field
|
|
253
|
+
[[0], [1]]
|
|
254
|
+
"""
|
|
255
|
+
self._Vrepresentation = []
|
|
256
|
+
parent = self.parent()
|
|
257
|
+
for v in vertices:
|
|
258
|
+
parent._make_Vertex(self, v)
|
|
259
|
+
for r in rays:
|
|
260
|
+
parent._make_Ray(self, r)
|
|
261
|
+
for l in lines:
|
|
262
|
+
parent._make_Line(self, l)
|
|
263
|
+
self._Vrepresentation = tuple(self._Vrepresentation)
|
|
264
|
+
|
|
265
|
+
def _init_Vrepresentation_backend(self, Vrep):
|
|
266
|
+
"""
|
|
267
|
+
Create the V-representation objects from the double description.
|
|
268
|
+
|
|
269
|
+
EXAMPLES::
|
|
270
|
+
|
|
271
|
+
sage: p = Polyhedron(vertices=[(0, 1/sqrt(2)), # indirect doctest # needs sage.rings.number_field sage.symbolic
|
|
272
|
+
....: (sqrt(2), 0),
|
|
273
|
+
....: (4, sqrt(5)/6)],
|
|
274
|
+
....: base_ring=AA, backend='field')
|
|
275
|
+
sage: p.Hrepresentation() # needs sage.rings.number_field sage.symbolic
|
|
276
|
+
(An inequality (-0.1582178750233332?, 1.097777812326429?) x + 0.2237538646678492? >= 0,
|
|
277
|
+
An inequality (-0.1419794359520263?, -1.698172434277148?) x + 1.200789243901438? >= 0,
|
|
278
|
+
An inequality (0.3001973109753594?, 0.600394621950719?) x - 0.4245431085692869? >= 0)
|
|
279
|
+
sage: p.Vrepresentation() # needs sage.rings.number_field sage.symbolic
|
|
280
|
+
(A vertex at (0.?e-16, 0.7071067811865475?),
|
|
281
|
+
A vertex at (1.414213562373095?, 0),
|
|
282
|
+
A vertex at (4.000000000000000?, 0.372677996249965?))
|
|
283
|
+
"""
|
|
284
|
+
self._init_Vrepresentation(Vrep.vertices, Vrep.rays, Vrep.lines)
|
|
285
|
+
|
|
286
|
+
def _init_Hrepresentation(self, inequalities, equations):
|
|
287
|
+
"""
|
|
288
|
+
Create the Vrepresentation objects from the given minimal data.
|
|
289
|
+
|
|
290
|
+
EXAMPLES::
|
|
291
|
+
|
|
292
|
+
sage: from sage.geometry.polyhedron.parent import Polyhedra_field
|
|
293
|
+
sage: from sage.geometry.polyhedron.backend_field import Polyhedron_field
|
|
294
|
+
sage: parent = Polyhedra_field(AA, 1, 'field') # needs sage.rings.number_field
|
|
295
|
+
sage: Vrep = [[[0], [1]], [], []]
|
|
296
|
+
sage: Hrep = [[[0, 1], [1, -1]], []]
|
|
297
|
+
sage: p = Polyhedron_field(parent, Vrep, Hrep, # indirect doctest # needs sage.rings.number_field
|
|
298
|
+
....: Vrep_minimal=True, Hrep_minimal=True)
|
|
299
|
+
sage: p.inequalities_list() # needs sage.rings.number_field
|
|
300
|
+
[[0, 1], [1, -1]]
|
|
301
|
+
"""
|
|
302
|
+
self._Hrepresentation = []
|
|
303
|
+
parent = self.parent()
|
|
304
|
+
for ieq in inequalities:
|
|
305
|
+
parent._make_Inequality(self, ieq)
|
|
306
|
+
for eqn in equations:
|
|
307
|
+
parent._make_Equation(self, eqn)
|
|
308
|
+
self._Hrepresentation = tuple(self._Hrepresentation)
|
|
309
|
+
|
|
310
|
+
def _init_Hrepresentation_backend(self, Hrep):
|
|
311
|
+
"""
|
|
312
|
+
Create the H-representation objects from the double description.
|
|
313
|
+
|
|
314
|
+
EXAMPLES::
|
|
315
|
+
|
|
316
|
+
sage: p = Polyhedron(vertices=[(0, 1/sqrt(2)), # indirect doctest # needs sage.rings.number_field sage.symbolic
|
|
317
|
+
....: (sqrt(2), 0),
|
|
318
|
+
....: (4, sqrt(5)/6)],
|
|
319
|
+
....: base_ring=AA, backend='field')
|
|
320
|
+
sage: p.Hrepresentation() # needs sage.rings.number_field sage.symbolic
|
|
321
|
+
(An inequality (-0.1582178750233332?, 1.097777812326429?) x + 0.2237538646678492? >= 0,
|
|
322
|
+
An inequality (-0.1419794359520263?, -1.698172434277148?) x + 1.200789243901438? >= 0,
|
|
323
|
+
An inequality (0.3001973109753594?, 0.600394621950719?) x - 0.4245431085692869? >= 0)
|
|
324
|
+
sage: p.Vrepresentation() # needs sage.rings.number_field sage.symbolic
|
|
325
|
+
(A vertex at (0.?e-16, 0.7071067811865475?),
|
|
326
|
+
A vertex at (1.414213562373095?, 0),
|
|
327
|
+
A vertex at (4.000000000000000?, 0.372677996249965?))
|
|
328
|
+
"""
|
|
329
|
+
self._init_Hrepresentation(Hrep.inequalities, Hrep.equations)
|
|
330
|
+
|
|
331
|
+
def _init_empty_polyhedron(self):
|
|
332
|
+
"""
|
|
333
|
+
Initialize an empty polyhedron.
|
|
334
|
+
|
|
335
|
+
TESTS::
|
|
336
|
+
|
|
337
|
+
sage: empty = Polyhedron(backend='field', base_ring=AA); empty # needs sage.rings.number_field
|
|
338
|
+
The empty polyhedron in AA^0
|
|
339
|
+
sage: empty.Vrepresentation() # needs sage.rings.number_field
|
|
340
|
+
()
|
|
341
|
+
sage: empty.Hrepresentation() # needs sage.rings.number_field
|
|
342
|
+
(An equation -1 == 0,)
|
|
343
|
+
sage: Polyhedron(vertices=[], backend='field')
|
|
344
|
+
The empty polyhedron in QQ^0
|
|
345
|
+
sage: Polyhedron(backend='field')._init_empty_polyhedron()
|
|
346
|
+
"""
|
|
347
|
+
super()._init_empty_polyhedron()
|