Skip to content
This repository was archived by the owner on Feb 1, 2023. It is now read-only.

Commit aa09eef

Browse files
author
Release Manager
committed
Trac #28866: doctest killed due to abort in geometry/polyhedron/base.py
On a clean develop branch running `SageMath version 9.1.beta9, Release Date: 2020-03-29`, I get: {{{ $ sage -t --long --memlimit=3600 src/sage/geometry/polyhedron/base.py too many failed tests, not using stored timings Running doctests with ID 2020-04-01-21-12-24-30fbb892. Git branch: develop Using --optional=4ti2,build,cbc,ccache,cryptominisat,dochtml,dot2tex,e_a ntic,glucose,latte_int,lidia,lrslib,memlimit,normaliz,notedown,openssl,p andoc_attributes,pycosat,pynormaliz,rst2ipynb,sage,sage_numerical_backen ds_coin,sage_numerical_backends_cplex,sage_numerical_backends_gurobi Doctesting 1 file. sage -t --long src/sage/geometry/polyhedron/base.py [1485 tests, 26.12 s] ---------------------------------------------------------------------- All tests passed! ---------------------------------------------------------------------- Total time for all tests: 26.4 seconds cpu time: 24.0 seconds cumulative wall time: 26.1 seconds }}} while {{{ sage -t --long --memlimit=3500 src/sage/geometry/polyhedron/base.py }}} or {{{ sage -t --long src/sage/geometry/polyhedron/base.py }}} gives {{{ Using --optional=4ti2,build,cbc,ccache,cryptominisat,dochtml,dot2tex,e_a ntic,glucose,latte_int,lidia,lrslib,memlimit,normaliz,notedown,openssl,p andoc_attributes,pycosat,pynormaliz,rst2ipynb,sage,sagenb Doctesting 1 file. sage -t --long src/sage/geometry/polyhedron/base.py ********************************************************************** File "src/sage/geometry/polyhedron/base.py", line 7172, in sage.geometry.polyhedron.base.Polyhedron_base.integral_points Failed example: P = 1/10*polytopes.hypercube(14) Exception raised: Traceback (most recent call last): File "/home/slabbe/GitBox/sage/local/lib/python3.7/site- packages/sage/doctest/forker.py", line 681, in _run self.compile_and_execute(example, compiler, test.globs) File "/home/slabbe/GitBox/sage/local/lib/python3.7/site- packages/sage/doctest/forker.py", line 1123, in compile_and_execute exec(compiled, globs) File "<doctest sage.geometry.polyhedron.base.Polyhedron_base.integral_points[12]>", line 1, in <module> P = Integer(1)/Integer(10)*polytopes.hypercube(Integer(14)) File "/home/slabbe/GitBox/sage/local/lib/python3.7/site- packages/sage/geometry/polyhedron/library.py", line 2749, in hypercube return Polyhedron(vertices=list(itertools.product([1, -1], repeat=dim)), base_ring=ZZ, backend=backend) File "/home/slabbe/GitBox/sage/local/lib/python3.7/site- packages/sage/geometry/polyhedron/constructor.py", line 626, in Polyhedron return parent(Vrep, Hrep, convert=convert, verbose=verbose) File "sage/structure/parent.pyx", line 902, in sage.structure.parent.Parent.__call__ (build/cythonized/sage/structure/parent.c:9245) return mor._call_with_args(x, args, kwds) File "sage/structure/coerce_maps.pyx", line 180, in sage.structure.coerce_maps.DefaultConvertMap_unique._call_with_args (build/cythonized/sage/structure/coerce_maps.c:5081) raise File "sage/structure/coerce_maps.pyx", line 175, in sage.structure.coerce_maps.DefaultConvertMap_unique._call_with_args (build/cythonized/sage/structure/coerce_maps.c:4969) return C._element_constructor(x, *args, **kwds) File "/home/slabbe/GitBox/sage/local/lib/python3.7/site- packages/sage/geometry/polyhedron/parent.py", line 525, in _element_constructor_ return self.element_class(self, Vrep, Hrep, **kwds) File "/home/slabbe/GitBox/sage/local/lib/python3.7/site- packages/sage/geometry/polyhedron/base.py", line 121, in __init__ self._init_from_Vrepresentation(vertices, rays, lines, **kwds) File "/home/slabbe/GitBox/sage/local/lib/python3.7/site- packages/sage/geometry/polyhedron/backend_ppl.py", line 93, in _init_from_Vrepresentation self._init_Vrepresentation_from_ppl(minimize) File "/home/slabbe/GitBox/sage/local/lib/python3.7/site- packages/sage/geometry/polyhedron/backend_ppl.py", line 161, in _init_Vrepresentation_from_ppl gs = self._ppl_polyhedron.minimized_generators() File "ppl/polyhedron.pyx", line 335, in ppl.polyhedron.Polyhedron.minimized_generators RuntimeError: Aborted ********************************************************************** ... Killed due to abort ********************************************************************** Tests run before process (pid=19555) failed: sage: p = polytopes.hypercube(2) ## line 71 ## sage: from sage.geometry.polyhedron.base import is_Polyhedron ## line 72 ## sage: is_Polyhedron(p) ## line 73 ## True ... sage: v = [(1,0,7,-1), (-2,-2,4,-3), (-1,-1,-1,4), (2,9,0,-5), (-2,-1,5,1)] ## line 7164 ## sage: simplex = Polyhedron(v); simplex ## line 7165 ## A 4-dimensional polyhedron in ZZ^4 defined as the convex hull of 5 vertices sage: len(simplex.integral_points()) ## line 7167 ## 49 sage: P = 1/10*polytopes.hypercube(14) ## line 7172 ## sig_error() without sig_on() ---------------------------------------------------------------------- sage -t --long src/sage/geometry/polyhedron/base.py # Killed due to abort ---------------------------------------------------------------------- }}} URL: https://trac.sagemath.org/28866 Reported by: slabbe Ticket author(s): Jonathan Kliem Reviewer(s): Sébastien Labbé, Michael Orlitzky, Matthias Koeppe
2 parents 98c7ce0 + c701c31 commit aa09eef

File tree

5 files changed

+138
-91
lines changed

5 files changed

+138
-91
lines changed

src/sage/geometry/polyhedron/base.py

Lines changed: 75 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,10 @@ class Polyhedron_base(Element):
104104
105105
- ``Hrep_minimal`` (optional) -- see below
106106
107+
- ``pref_rep`` -- string (default: ``None``);
108+
one of``Vrep`` or ``Hrep`` to pick this in case the backend
109+
cannot initialize from complete double description
110+
107111
If both ``Vrep`` and ``Hrep`` are provided, then
108112
``Vrep_minimal`` and ``Hrep_minimal`` must be set to ``True``.
109113
@@ -113,7 +117,7 @@ class Polyhedron_base(Element):
113117
sage: TestSuite(p).run()
114118
"""
115119

116-
def __init__(self, parent, Vrep, Hrep, Vrep_minimal=None, Hrep_minimal=None, **kwds):
120+
def __init__(self, parent, Vrep, Hrep, Vrep_minimal=None, Hrep_minimal=None, pref_rep=None, **kwds):
117121
"""
118122
Initializes the polyhedron.
119123
@@ -134,6 +138,35 @@ def __init__(self, parent, Vrep, Hrep, Vrep_minimal=None, Hrep_minimal=None, **k
134138
Traceback (most recent call last):
135139
...
136140
ValueError: if both Vrep and Hrep are provided, they must be minimal...
141+
142+
Illustration of ``pref_rep``.
143+
Note that ``ppl`` doesn't support precomputed data::
144+
145+
sage: from sage.geometry.polyhedron.backend_ppl import Polyhedron_QQ_ppl
146+
sage: from sage.geometry.polyhedron.parent import Polyhedra_QQ_ppl
147+
sage: parent = Polyhedra_QQ_ppl(QQ, 1, 'ppl')
148+
sage: p = Polyhedron_QQ_ppl(parent, Vrep, 'nonsense',
149+
....: Vrep_minimal=True, Hrep_minimal=True, pref_rep='Vrep')
150+
sage: p = Polyhedron_QQ_ppl(parent, 'nonsense', Hrep,
151+
....: Vrep_minimal=True, Hrep_minimal=True, pref_rep='Hrep')
152+
sage: p = Polyhedron_QQ_ppl(parent, 'nonsense', Hrep,
153+
....: Vrep_minimal=True, Hrep_minimal=True, pref_rep='Vrepresentation')
154+
Traceback (most recent call last):
155+
...
156+
ValueError: ``pref_rep`` must be one of ``(None, 'Vrep', 'Hrep')``
157+
158+
If the backend supports precomputed data, ``pref_rep`` is ignored::
159+
160+
sage: p = Polyhedron_field(parent, Vrep, 'nonsense', # py3
161+
....: Vrep_minimal=True, Hrep_minimal=True, pref_rep='Vrep')
162+
Traceback (most recent call last):
163+
...
164+
TypeError: _init_Hrepresentation() takes 3 positional arguments but 9 were given
165+
sage: p = Polyhedron_field(parent, Vrep, 'nonsense', # py2
166+
....: Vrep_minimal=True, Hrep_minimal=True, pref_rep='Vrep')
167+
Traceback (most recent call last):
168+
...
169+
TypeError: _init_Hrepresentation() takes exactly 3 arguments (9 given)
137170
"""
138171
Element.__init__(self, parent=parent)
139172
if Vrep is not None and Hrep is not None:
@@ -144,11 +177,20 @@ def __init__(self, parent, Vrep, Hrep, Vrep_minimal=None, Hrep_minimal=None, **k
144177
self._init_from_Vrepresentation_and_Hrepresentation(Vrep, Hrep)
145178
return
146179
else:
147-
# Initialize from Hrepresentation if this seems simpler.
148-
Vrep = [tuple(Vrep[0]), tuple(Vrep[1]), Vrep[2]]
149-
Hrep = [tuple(Hrep[0]), Hrep[1]]
150-
if len(Hrep[0]) < len(Vrep[0]) + len(Vrep[1]):
180+
if pref_rep is None:
181+
# Initialize from Hrepresentation if this seems simpler.
182+
Vrep = [tuple(Vrep[0]), tuple(Vrep[1]), Vrep[2]]
183+
Hrep = [tuple(Hrep[0]), Hrep[1]]
184+
if len(Hrep[0]) < len(Vrep[0]) + len(Vrep[1]):
185+
pref_rep = 'Hrep'
186+
else:
187+
pref_rep = 'Vrep'
188+
if pref_rep == 'Vrep':
189+
Hrep = None
190+
elif pref_rep == 'Hrep':
151191
Vrep = None
192+
else:
193+
raise ValueError("``pref_rep`` must be one of ``(None, 'Vrep', 'Hrep')``")
152194
if Vrep is not None:
153195
vertices, rays, lines = Vrep
154196
if vertices or rays or lines:
@@ -1080,11 +1122,12 @@ def cdd_Hrepresentation(self):
10801122
H-representation
10811123
begin
10821124
4 3 rational
1083-
1 1 0
1084-
1 0 1
10851125
1 -1 0
10861126
1 0 -1
1127+
1 1 0
1128+
1 0 1
10871129
end
1130+
<BLANKLINE>
10881131
10891132
sage: triangle = Polyhedron(vertices = [[1,0],[0,1],[1,1]],base_ring=AA)
10901133
sage: triangle.base_ring()
@@ -4461,36 +4504,30 @@ def dilation(self, scalar):
44614504
sage: test_dilation(polytopes.permutahedron(3)*Polyhedron(rays=[[0,0,1],[0,1,1]], lines=[[1,0,0]]))
44624505
"""
44634506
parent = self.parent().base_extend(scalar)
4464-
one = parent.base_ring().one()
4465-
if scalar > 0:
4466-
new_vertices = [ list(scalar*v.vector()) for v in self.vertex_generator() ]
4467-
new_rays = self.rays()
4468-
new_lines = self.lines()
4469-
new_inequalities = [f.vector()*one for f in self.inequality_generator()]
4470-
for f in new_inequalities:
4471-
f[0] *= scalar
4472-
new_equations = [e.vector()*one for e in self.equation_generator()]
4473-
for e in new_equations:
4474-
e[0] *= scalar
4475-
elif scalar < 0:
4476-
new_vertices = [ list(scalar*v.vector()) for v in self.vertex_generator() ]
4477-
new_rays = [ list(-r.vector()) for r in self.ray_generator()]
4478-
new_lines = self.lines()
4479-
new_inequalities = [-f.vector()*one for f in self.inequality_generator()]
4480-
for f in new_inequalities:
4481-
f[0] *= scalar
4482-
new_equations = [-e.vector()*one for e in self.equation_generator()]
4483-
for e in new_equations:
4484-
e[0] *= scalar
4485-
else:
4486-
new_vertices = [ self.ambient_space().zero() for v in self.vertex_generator() ]
4507+
4508+
if scalar == 0:
4509+
new_vertices = tuple(self.ambient_space().zero() for v in self.vertex_generator())
44874510
new_rays = []
44884511
new_lines = []
44894512
return parent.element_class(parent, [new_vertices, new_rays, new_lines], None)
44904513

4514+
one = parent.base_ring().one()
4515+
sign = one if scalar > 0 else -one
4516+
4517+
make_new_Hrep = lambda h : tuple(scalar*sign*x if i == 0 else sign*x
4518+
for i,x in enumerate(h._vector))
4519+
4520+
new_vertices = (tuple(scalar*x for x in v._vector) for v in self.vertex_generator())
4521+
new_rays = (tuple(sign*x for x in r._vector) for r in self.ray_generator())
4522+
new_lines = self.line_generator()
4523+
new_inequalities = map(make_new_Hrep, self.inequality_generator())
4524+
new_equations = map(make_new_Hrep, self.equation_generator())
4525+
4526+
pref_rep = 'Vrep' if self.n_vertices() + self.n_rays() <= self.n_inequalities() else 'Hrep'
4527+
44914528
return parent.element_class(parent, [new_vertices, new_rays, new_lines],
44924529
[new_inequalities, new_equations],
4493-
Vrep_minimal=True, Hrep_minimal=True)
4530+
Vrep_minimal=True, Hrep_minimal=True, pref_rep=pref_rep)
44944531

44954532
def linear_transformation(self, linear_transf):
44964533
"""
@@ -5622,20 +5659,20 @@ def face_lattice(self):
56225659
sage: fl = square.face_lattice();fl
56235660
Finite lattice containing 10 elements with distinguished linear extension
56245661
sage: list(f.ambient_V_indices() for f in fl)
5625-
[(), (0,), (1,), (2,), (3,), (0, 1), (0, 2), (2, 3), (1, 3), (0, 1, 2, 3)]
5662+
[(), (0,), (1,), (2,), (3,), (0, 1), (1, 2), (2, 3), (0, 3), (0, 1, 2, 3)]
56265663
sage: poset_element = fl[6]
56275664
sage: a_face = poset_element
56285665
sage: a_face
56295666
A 1-dimensional face of a Polyhedron in ZZ^2 defined as the convex hull of 2 vertices
56305667
sage: a_face.ambient_V_indices()
5631-
(0, 2)
5668+
(1, 2)
56325669
sage: set(a_face.ambient_Vrepresentation()) == \
5633-
....: set([square.Vrepresentation(0), square.Vrepresentation(2)])
5670+
....: set([square.Vrepresentation(1), square.Vrepresentation(2)])
56345671
True
56355672
sage: a_face.ambient_Vrepresentation()
5636-
(A vertex at (-1, -1), A vertex at (1, -1))
5673+
(A vertex at (1, 1), A vertex at (-1, 1))
56375674
sage: a_face.ambient_Hrepresentation()
5638-
(An inequality (0, 1) x + 1 >= 0,)
5675+
(An inequality (0, -1) x + 1 >= 0,)
56395676
56405677
A more complicated example::
56415678
@@ -7958,8 +7995,8 @@ def integral_points(self, threshold=100000):
79587995
79597996
A case where rounding in the right direction goes a long way::
79607997
7961-
sage: P = 1/10*polytopes.hypercube(14) # long time
7962-
sage: P.integral_points() # long time
7998+
sage: P = 1/10*polytopes.hypercube(14, backend='field')
7999+
sage: P.integral_points()
79638000
((0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),)
79648001
79658002
Finally, the 3-d reflexive polytope number 4078::

src/sage/geometry/polyhedron/face.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -341,9 +341,9 @@ def __richcmp__(self, other, op):
341341
sage: square = polytopes.hypercube(2)
342342
sage: f = square.faces(1)
343343
sage: matrix(4,4, lambda i,j: ZZ(f[i] <= f[j]))
344-
[1 1 0 0]
345-
[0 1 0 0]
346344
[1 1 1 0]
345+
[0 1 0 0]
346+
[0 1 1 0]
347347
[1 1 1 1]
348348
sage: matrix(4,4, lambda i,j: ZZ(f[i] == f[j])) == 1
349349
True
@@ -379,16 +379,16 @@ def ambient_Hrepresentation(self, index=None):
379379
sage: square = polytopes.hypercube(2)
380380
sage: for face in square.face_lattice():
381381
....: print(face.ambient_Hrepresentation())
382-
(An inequality (1, 0) x + 1 >= 0, An inequality (0, 1) x + 1 >= 0,
383-
An inequality (-1, 0) x + 1 >= 0, An inequality (0, -1) x + 1 >= 0)
384-
(An inequality (1, 0) x + 1 >= 0, An inequality (0, 1) x + 1 >= 0)
385-
(An inequality (1, 0) x + 1 >= 0, An inequality (0, -1) x + 1 >= 0)
386-
(An inequality (0, 1) x + 1 >= 0, An inequality (-1, 0) x + 1 >= 0)
382+
(An inequality (-1, 0) x + 1 >= 0, An inequality (0, -1) x + 1 >= 0,
383+
An inequality (1, 0) x + 1 >= 0, An inequality (0, 1) x + 1 >= 0)
384+
(An inequality (-1, 0) x + 1 >= 0, An inequality (0, 1) x + 1 >= 0)
387385
(An inequality (-1, 0) x + 1 >= 0, An inequality (0, -1) x + 1 >= 0)
388-
(An inequality (1, 0) x + 1 >= 0,)
389-
(An inequality (0, 1) x + 1 >= 0,)
386+
(An inequality (0, -1) x + 1 >= 0, An inequality (1, 0) x + 1 >= 0)
387+
(An inequality (1, 0) x + 1 >= 0, An inequality (0, 1) x + 1 >= 0)
390388
(An inequality (-1, 0) x + 1 >= 0,)
391389
(An inequality (0, -1) x + 1 >= 0,)
390+
(An inequality (1, 0) x + 1 >= 0,)
391+
(An inequality (0, 1) x + 1 >= 0,)
392392
()
393393
"""
394394
if index is None:
@@ -421,16 +421,16 @@ def ambient_Vrepresentation(self, index=None):
421421
sage: for fl in square.face_lattice():
422422
....: print(fl.ambient_Vrepresentation())
423423
()
424-
(A vertex at (-1, -1),)
425-
(A vertex at (-1, 1),)
426424
(A vertex at (1, -1),)
427425
(A vertex at (1, 1),)
428-
(A vertex at (-1, -1), A vertex at (-1, 1))
429-
(A vertex at (-1, -1), A vertex at (1, -1))
426+
(A vertex at (-1, 1),)
427+
(A vertex at (-1, -1),)
430428
(A vertex at (1, -1), A vertex at (1, 1))
431-
(A vertex at (-1, 1), A vertex at (1, 1))
432-
(A vertex at (-1, -1), A vertex at (-1, 1),
433-
A vertex at (1, -1), A vertex at (1, 1))
429+
(A vertex at (1, 1), A vertex at (-1, 1))
430+
(A vertex at (-1, 1), A vertex at (-1, -1))
431+
(A vertex at (1, -1), A vertex at (-1, -1))
432+
(A vertex at (1, -1), A vertex at (1, 1),
433+
A vertex at (-1, 1), A vertex at (-1, -1))
434434
"""
435435
if index is None:
436436
return self._ambient_Vrepresentation

src/sage/geometry/polyhedron/library.py

Lines changed: 29 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2831,26 +2831,25 @@ def hypercube(self, dim, intervals=None, backend=None):
28312831
parent = Polyhedra(ZZ, dim, backend=backend)
28322832
convert = False
28332833

2834-
# Preparing the inequalities:
28352834
# If the intervals are (a_1,b_1), ..., (a_dim, b_dim),
28362835
# then the inequalites correspond to
28372836
# b_1,b_2,...,b_dim, a_1,a_2,...,a_dim
28382837
# in that order.
2839-
ieqs = [[0]*(dim+1) for _ in range(2*dim)]
2840-
for i in range(dim):
2841-
ieqs[i][i+1] = -1
2842-
ieqs[dim+i][i+1] = 1
28432838

28442839
if intervals is None:
2845-
cp = list(itertools.product([-1,1], repeat=dim))
2846-
for i in range(dim):
2847-
ieqs[i][0] = 1 # An inequality -x_i + 1 >= 0
2848-
ieqs[i+dim][0] = 1 # An inequality x_i + 1 >= 0
2840+
cp = itertools.product((-1,1), repeat=dim)
2841+
2842+
# An inequality -x_i + 1 >= 0 for i < dim
2843+
# resp. x_{dim-i} + 1 >= 0 for i >= dim
2844+
ieq_b = lambda i: 1
2845+
28492846
elif isinstance(intervals, str):
28502847
if intervals == 'zero_one':
2851-
cp = list(itertools.product([0,1], repeat=dim))
2852-
for i in range(dim):
2853-
ieqs[i][0] = 1 # An inequality -x_i + 1 >= 0
2848+
cp = itertools.product((0,1), repeat=dim)
2849+
2850+
# An inequality -x_i + 1 >= 0 for i < dim
2851+
# resp. x_{dim-i} + 0 >= 0 for i >= dim
2852+
ieq_b = lambda i: 1 if i < dim else 0
28542853
else:
28552854
raise ValueError("the only allowed string is 'zero_one'")
28562855
elif len(intervals) == dim:
@@ -2864,14 +2863,25 @@ def hypercube(self, dim, intervals=None, backend=None):
28642863
# the specified backend cannot handle the intervals.
28652864
raise ValueError("specified backend {} cannot handle the intervals".format(backend))
28662865

2867-
cp = list(itertools.product(*intervals))
2868-
for i in range(dim):
2869-
ieqs[i][0] = intervals[i][1] # An inequality -x_i + b_i >= 0
2870-
ieqs[i+dim][0] = -intervals[i][0] # An inequality x_i - a_i >= 0
2866+
cp = itertools.product(*intervals)
28712867

2868+
# An inequality -x_i + b_i >= 0 for i < dim
2869+
# resp. x_{dim-i} - a_i >= 0 for i >= dim
2870+
ieq_b = lambda i: intervals[i][1] if i < dim \
2871+
else intervals[i-dim][0]
28722872
else:
28732873
raise ValueError("the dimension of the hypercube must match the number of intervals")
2874-
return parent([cp, [], []], [ieqs, []], convert=convert, Vrep_minimal=True, Hrep_minimal=True)
2874+
2875+
# An inequality -x_i + ieq_b(i) >= 0 for i < dim
2876+
# resp. x_{dim-i} + ieq_b(i-dim) >= 0 for i >= dim
2877+
ieq_A = lambda i, pos: -1 if i == pos \
2878+
else 1 if i == pos + dim \
2879+
else 0
2880+
ieqs = (tuple(ieq_b(i) if pos == 0 else ieq_A(i, pos-1)
2881+
for pos in range(dim+1))
2882+
for i in range(2*dim))
2883+
2884+
return parent([cp, [], []], [ieqs, []], convert=convert, Vrep_minimal=True, Hrep_minimal=True, pref_rep='Hrep')
28752885

28762886
def cube(self, intervals=None, backend=None):
28772887
r"""
@@ -2970,9 +2980,9 @@ def cross_polytope(self, dim, backend=None):
29702980
"""
29712981
verts = tuple((ZZ**dim).basis())
29722982
verts += tuple(-v for v in verts)
2973-
ieqs = tuple((1,) + x for x in itertools.product([-1,1], repeat=dim))
2983+
ieqs = ((1,) + x for x in itertools.product((-1,1), repeat=dim))
29742984
parent = Polyhedra(ZZ, dim, backend=backend)
2975-
return parent([verts, [], []], [ieqs, []], Vrep_minimal=True, Hrep_minimal=True)
2985+
return parent([verts, [], []], [ieqs, []], Vrep_minimal=True, Hrep_minimal=True, pref_rep='Vrep')
29762986

29772987
def parallelotope(self, generators, backend=None):
29782988
r"""

src/sage/geometry/triangulation/element.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -606,10 +606,10 @@ def _boundary_simplex_dictionary(self):
606606
sage: triangulation = polytopes.hypercube(2).triangulate(engine='internal')
607607
sage: triangulation._boundary_simplex_dictionary()
608608
{(0, 1): ((0, 1, 3),),
609-
(0, 2): ((0, 2, 3),),
610-
(0, 3): ((0, 1, 3), (0, 2, 3)),
611-
(1, 3): ((0, 1, 3),),
612-
(2, 3): ((0, 2, 3),)}
609+
(0, 3): ((0, 1, 3),),
610+
(1, 2): ((1, 2, 3),),
611+
(1, 3): ((0, 1, 3), (1, 2, 3)),
612+
(2, 3): ((1, 2, 3),)}
613613
614614
sage: triangulation = polytopes.cube().triangulate(engine='internal')
615615
sage: triangulation._boundary_simplex_dictionary()
@@ -739,21 +739,21 @@ def normal_cone(self):
739739
740740
sage: triangulation = polytopes.hypercube(2).triangulate(engine='internal')
741741
sage: triangulation
742-
(<0,1,3>, <0,2,3>)
742+
(<0,1,3>, <1,2,3>)
743743
sage: N = triangulation.normal_cone(); N
744744
4-d cone in 4-d lattice
745745
sage: N.rays()
746-
(-1, 0, 0, 0),
747-
( 1, 0, 1, 0),
748-
(-1, 0, -1, 0),
749-
( 1, 0, 0, -1),
750-
(-1, 0, 0, 1),
751-
( 1, 1, 0, 0),
752-
(-1, -1, 0, 0)
746+
( 0, 0, 0, -1),
747+
( 0, 0, 1, 1),
748+
( 0, 0, -1, -1),
749+
( 1, 0, 0, 1),
750+
(-1, 0, 0, -1),
751+
( 0, 1, 0, -1),
752+
( 0, -1, 0, 1)
753753
in Ambient free module of rank 4
754754
over the principal ideal domain Integer Ring
755755
sage: N.dual().rays()
756-
(-1, 1, 1, -1)
756+
(1, -1, 1, -1)
757757
in Ambient free module of rank 4
758758
over the principal ideal domain Integer Ring
759759

src/sage/plot/graphics.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3403,12 +3403,12 @@ def description(self):
34033403
EXAMPLES::
34043404
34053405
sage: print(polytopes.hypercube(2).plot().description())
3406-
Polygon defined by 4 points: [(1.0, 1.0), (-1.0, 1.0), (-1.0, -1.0), (1.0, -1.0)]
3407-
Line defined by 2 points: [(-1.0, -1.0), (-1.0, 1.0)]
3408-
Line defined by 2 points: [(-1.0, -1.0), (1.0, -1.0)]
3409-
Line defined by 2 points: [(-1.0, 1.0), (1.0, 1.0)]
3406+
Polygon defined by 4 points: [(-1.0, -1.0), (1.0, -1.0), (1.0, 1.0), (-1.0, 1.0)]
3407+
Line defined by 2 points: [(-1.0, 1.0), (-1.0, -1.0)]
3408+
Line defined by 2 points: [(1.0, -1.0), (-1.0, -1.0)]
34103409
Line defined by 2 points: [(1.0, -1.0), (1.0, 1.0)]
3411-
Point set defined by 4 point(s): [(-1.0, -1.0), (-1.0, 1.0), (1.0, -1.0), (1.0, 1.0)]
3410+
Line defined by 2 points: [(1.0, 1.0), (-1.0, 1.0)]
3411+
Point set defined by 4 point(s): [(1.0, -1.0), (1.0, 1.0), (-1.0, 1.0), (-1.0, -1.0)]
34123412
"""
34133413
data = []
34143414
for g in self:

0 commit comments

Comments
 (0)