Skip to content

Commit 6770922

Browse files
author
Matthias Koeppe
committed
./sage -fixdoctests --only-tags --distribution sagemath-polyhedra --probe all src/sage/geometry
1 parent 2ed482a commit 6770922

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+714
-636
lines changed

src/sage/geometry/cone.py

Lines changed: 54 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -129,31 +129,33 @@
129129
130130
You can work with subcones that form faces of other cones::
131131
132-
sage: face = four_rays.faces(dim=2)[0] # needs sage.graphs
133-
sage: face # needs sage.graphs
132+
sage: # needs sage.graphs
133+
sage: face = four_rays.faces(dim=2)[0]
134+
sage: face
134135
2-d face of 3-d cone in 3-d lattice N
135-
sage: face.rays() # needs sage.graphs
136+
sage: face.rays()
136137
N(-1, -1, 1),
137138
N(-1, 1, 1)
138139
in 3-d lattice N
139-
sage: face.ambient_ray_indices() # needs sage.graphs
140+
sage: face.ambient_ray_indices()
140141
(2, 3)
141-
sage: four_rays.rays(face.ambient_ray_indices()) # needs sage.graphs
142+
sage: four_rays.rays(face.ambient_ray_indices())
142143
N(-1, -1, 1),
143144
N(-1, 1, 1)
144145
in 3-d lattice N
145146
146147
If you need to know inclusion relations between faces, you can use ::
147148
148-
sage: L = four_rays.face_lattice() # needs sage.graphs
149-
sage: [len(s) for s in L.level_sets()] # needs sage.graphs
149+
sage: # needs sage.graphs
150+
sage: L = four_rays.face_lattice()
151+
sage: [len(s) for s in L.level_sets()]
150152
[1, 4, 4, 1]
151-
sage: face = L.level_sets()[2][0] # needs sage.graphs
152-
sage: face.rays() # needs sage.graphs
153+
sage: face = L.level_sets()[2][0]
154+
sage: face.rays()
153155
N(1, 1, 1),
154156
N(1, -1, 1)
155157
in 3-d lattice N
156-
sage: L.hasse_diagram().neighbors_in(face) # needs sage.graphs
158+
sage: L.hasse_diagram().neighbors_in(face)
157159
[1-d face of 3-d cone in 3-d lattice N,
158160
1-d face of 3-d cone in 3-d lattice N]
159161
@@ -2095,13 +2097,14 @@ def adjacent(self):
20952097
20962098
EXAMPLES::
20972099
2100+
sage: # needs sage.graphs
20982101
sage: octant = Cone([(1,0,0), (0,1,0), (0,0,1)])
2099-
sage: octant.adjacent() # needs sage.graphs
2102+
sage: octant.adjacent()
21002103
()
2101-
sage: one_face = octant.faces(1)[0] # needs sage.graphs
2102-
sage: len(one_face.adjacent()) # needs sage.graphs
2104+
sage: one_face = octant.faces(1)[0]
2105+
sage: len(one_face.adjacent())
21032106
2
2104-
sage: one_face.adjacent()[1] # needs sage.graphs
2107+
sage: one_face.adjacent()[1]
21052108
1-d face of 3-d cone in 3-d lattice N
21062109
21072110
Things are a little bit subtle with fans, as we illustrate below.
@@ -2176,12 +2179,14 @@ def ambient(self):
21762179
3-d cone in 3-d lattice N
21772180
sage: cone.ambient() is cone
21782181
True
2179-
sage: face = cone.faces(1)[0] # needs sage.graphs
2180-
sage: face # needs sage.graphs
2182+
2183+
sage: # needs sage.graphs
2184+
sage: face = cone.faces(1)[0]
2185+
sage: face
21812186
1-d face of 3-d cone in 3-d lattice N
2182-
sage: face.ambient() # needs sage.graphs
2187+
sage: face.ambient()
21832188
3-d cone in 3-d lattice N
2184-
sage: face.ambient() is cone # needs sage.graphs
2189+
sage: face.ambient() is cone
21852190
True
21862191
"""
21872192
return self._ambient
@@ -2377,22 +2382,23 @@ def embed(self, cone):
23772382
If we want to operate with this ray as a face of the cone, we need to
23782383
embed it first::
23792384
2380-
sage: e_ray = c.embed(ray) # needs sage.graphs
2381-
sage: e_ray # needs sage.graphs
2385+
sage: # needs sage.graphs
2386+
sage: e_ray = c.embed(ray)
2387+
sage: e_ray
23822388
1-d face of 3-d cone in 3-d lattice N
2383-
sage: e_ray.rays() # needs sage.graphs
2389+
sage: e_ray.rays()
23842390
N(0, -1, 1)
23852391
in 3-d lattice N
2386-
sage: e_ray is ray # needs sage.graphs
2392+
sage: e_ray is ray
23872393
False
2388-
sage: e_ray.is_equivalent(ray) # needs sage.graphs
2394+
sage: e_ray.is_equivalent(ray)
23892395
True
2390-
sage: e_ray.ambient_ray_indices() # needs sage.graphs
2396+
sage: e_ray.ambient_ray_indices()
23912397
(3,)
2392-
sage: e_ray.adjacent() # needs sage.graphs
2398+
sage: e_ray.adjacent()
23932399
(1-d face of 3-d cone in 3-d lattice N,
23942400
1-d face of 3-d cone in 3-d lattice N)
2395-
sage: e_ray.ambient() # needs sage.graphs
2401+
sage: e_ray.ambient()
23962402
3-d cone in 3-d lattice N
23972403
23982404
Not every cone can be embedded into a fixed ambient cone::
@@ -2492,19 +2498,20 @@ def face_lattice(self):
24922498
However, you can achieve some of this functionality using
24932499
:meth:`facets`, :meth:`facet_of`, and :meth:`adjacent` methods::
24942500
2495-
sage: face = quadrant.faces(1)[0] # needs sage.graphs
2496-
sage: face # needs sage.graphs
2501+
sage: # needs sage.graphs
2502+
sage: face = quadrant.faces(1)[0]
2503+
sage: face
24972504
1-d face of 2-d cone in 2-d lattice N
2498-
sage: face.rays() # needs sage.graphs
2505+
sage: face.rays()
24992506
N(1, 0)
25002507
in 2-d lattice N
2501-
sage: face.facets() # needs sage.graphs
2508+
sage: face.facets()
25022509
(0-d face of 2-d cone in 2-d lattice N,)
2503-
sage: face.facet_of() # needs sage.graphs
2510+
sage: face.facet_of()
25042511
(2-d cone in 2-d lattice N,)
2505-
sage: face.adjacent() # needs sage.graphs
2512+
sage: face.adjacent()
25062513
(1-d face of 2-d cone in 2-d lattice N,)
2507-
sage: face.adjacent()[0].rays() # needs sage.graphs
2514+
sage: face.adjacent()[0].rays()
25082515
N(0, 1)
25092516
in 2-d lattice N
25102517
@@ -2720,7 +2727,7 @@ def faces(self, dim=None, codim=None):
27202727
sage: halfplane.faces() # needs sage.graphs
27212728
((1-d face of 2-d cone in 2-d lattice N,),
27222729
(2-d cone in 2-d lattice N,))
2723-
sage: plane = Cone([(1,0), (0,1), (-1,-1)]) # needs sage.graphs
2730+
sage: plane = Cone([(1,0), (0,1), (-1,-1)])
27242731
sage: plane.faces(1) # needs sage.graphs
27252732
()
27262733
sage: plane.faces() # needs sage.graphs
@@ -2745,16 +2752,17 @@ def faces(self, dim=None, codim=None):
27452752
We also ensure that a call to this function does not break
27462753
:meth:`facets` method (see :trac:`9780`)::
27472754
2748-
sage: cone = toric_varieties.dP8().fan().generating_cone(0); cone # needs palp
2755+
sage: # needs palp
2756+
sage: cone = toric_varieties.dP8().fan().generating_cone(0); cone # needs sage.graphs
27492757
2-d cone of Rational polyhedral fan in 2-d lattice N
2750-
sage: for f in cone.facets(): print(f.rays()) # needs palp sage.graphs
2758+
sage: for f in cone.facets(): print(f.rays()) # needs sage.graphs
27512759
N(1, 1)
27522760
in 2-d lattice N
27532761
N(0, 1)
27542762
in 2-d lattice N
2755-
sage: len(cone.faces()) # needs palp sage.graphs
2763+
sage: len(cone.faces()) # needs sage.graphs
27562764
3
2757-
sage: for f in cone.facets(): print(f.rays()) # needs palp sage.graphs
2765+
sage: for f in cone.facets(): print(f.rays()) # needs sage.graphs
27582766
N(1, 1)
27592767
in 2-d lattice N
27602768
N(0, 1)
@@ -3263,7 +3271,7 @@ def is_isomorphic(self, other):
32633271
sage: K.is_isomorphic(K) # needs sage.graphs
32643272
True
32653273
sage: K = cones.trivial(2)
3266-
sage: K.is_isomorphic(K) # needs sage.graphs
3274+
sage: K.is_isomorphic(K)
32673275
True
32683276
32693277
A random (strictly convex) cone is isomorphic to itself::
@@ -6056,19 +6064,20 @@ def cross_positive_operators_gens(self):
60566064
The cross-positive operators of a permuted cone can be obtained by
60576065
conjugation::
60586066
6067+
sage: # needs sage.groups
60596068
sage: K = random_cone(max_ambient_dim=3)
60606069
sage: L = ToricLattice(K.lattice_dim()**2)
6061-
sage: p = SymmetricGroup(K.lattice_dim()).random_element().matrix() # needs sage.groups
6062-
sage: pK = Cone((p*k for k in K), K.lattice(), check=False) # needs sage.groups
6063-
sage: cp_gens = pK.cross_positive_operators_gens() # needs sage.groups
6064-
sage: actual = Cone((g.list() for g in cp_gens), # needs sage.groups
6070+
sage: p = SymmetricGroup(K.lattice_dim()).random_element().matrix()
6071+
sage: pK = Cone((p*k for k in K), K.lattice(), check=False)
6072+
sage: cp_gens = pK.cross_positive_operators_gens()
6073+
sage: actual = Cone((g.list() for g in cp_gens),
60656074
....: lattice=L,
60666075
....: check=False)
60676076
sage: cp_gens = K.cross_positive_operators_gens()
6068-
sage: expected = Cone(((p*g*p.inverse()).list() for g in cp_gens), # needs sage.groups
6077+
sage: expected = Cone(((p*g*p.inverse()).list() for g in cp_gens),
60696078
....: lattice=L,
60706079
....: check=False)
6071-
sage: actual.is_equivalent(expected) # needs sage.groups
6080+
sage: actual.is_equivalent(expected)
60726081
True
60736082
60746083
An operator is cross-positive on a cone if and only if its

src/sage/geometry/cone_catalog.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -529,8 +529,8 @@ def schur(ambient_dim=None, lattice=None):
529529
530530
sage: P = cones.schur(5)
531531
sage: Q = cones.nonnegative_orthant(5)
532-
sage: G = ( g.change_ring(QQbar).normalized() for g in P ) # needs sage.rings.number_fields
533-
sage: H = ( h.change_ring(QQbar).normalized() for h in Q ) # needs sage.rings.number_fields
532+
sage: G = ( g.change_ring(QQbar).normalized() for g in P )
533+
sage: H = ( h.change_ring(QQbar).normalized() for h in Q )
534534
sage: actual = max(arccos(u.inner_product(v)) for u in G for v in H) # needs sage.rings.number_fields
535535
sage: expected = 3*pi/4 # needs sage.rings.number_fields
536536
sage: abs(actual - expected).n() < 1e-12 # needs sage.rings.number_fields
@@ -566,7 +566,7 @@ def schur(ambient_dim=None, lattice=None):
566566
True
567567
sage: x = V.random_element()
568568
sage: y = V.random_element()
569-
sage: majorized_by(x,y) == ( (y-x) in S ) # needs sage.rings.number_fields
569+
sage: majorized_by(x,y) == ( (y-x) in S )
570570
True
571571
572572
If a ``lattice`` was given, it is actually used::

src/sage/geometry/fan.py

Lines changed: 29 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1027,12 +1027,13 @@ class Cone_of_fan(ConvexRationalPolyhedralCone):
10271027
10281028
The intended way to get objects of this class is the following::
10291029
1030-
sage: fan = toric_varieties.P1xP1().fan() # needs palp
1031-
sage: cone = fan.generating_cone(0); cone # needs palp
1030+
sage: # needs palp
1031+
sage: fan = toric_varieties.P1xP1().fan()
1032+
sage: cone = fan.generating_cone(0); cone
10321033
2-d cone of Rational polyhedral fan in 2-d lattice N
1033-
sage: cone.ambient_ray_indices() # needs palp
1034+
sage: cone.ambient_ray_indices()
10341035
(0, 2)
1035-
sage: cone.star_generator_indices() # needs palp
1036+
sage: cone.star_generator_indices()
10361037
(0,)
10371038
"""
10381039

@@ -1065,11 +1066,12 @@ def _repr_(self) -> str:
10651066
10661067
TESTS::
10671068
1068-
sage: P1xP1 = toric_varieties.P1xP1() # needs palp
1069-
sage: cone = P1xP1.fan().generating_cone(0) # needs palp
1070-
sage: cone._repr_() # needs palp
1069+
sage: # needs palp
1070+
sage: P1xP1 = toric_varieties.P1xP1()
1071+
sage: cone = P1xP1.fan().generating_cone(0)
1072+
sage: cone._repr_()
10711073
'2-d cone of Rational polyhedral fan in 2-d lattice N'
1072-
sage: cone.facets()[0]._repr_() # needs palp
1074+
sage: cone.facets()[0]._repr_()
10731075
'1-d cone of Rational polyhedral fan in 2-d lattice N'
10741076
"""
10751077
# The base class would print "face of" instead of "cone of"
@@ -2525,12 +2527,13 @@ def vertex_graph(self):
25252527
25262528
EXAMPLES::
25272529
2528-
sage: dP8 = toric_varieties.dP8() # needs palp
2529-
sage: g = dP8.fan().vertex_graph(); g # needs palp
2530+
sage: # needs palp
2531+
sage: dP8 = toric_varieties.dP8()
2532+
sage: g = dP8.fan().vertex_graph(); g
25302533
Graph on 4 vertices
2531-
sage: set(dP8.fan(1)) == set(g.vertices(sort=False)) # needs palp
2534+
sage: set(dP8.fan(1)) == set(g.vertices(sort=False))
25322535
True
2533-
sage: g.edge_labels() # all edge labels the same since every cone is smooth # needs palp
2536+
sage: g.edge_labels() # all edge labels the same since every cone is smooth
25342537
[(1, 0), (1, 0), (1, 0), (1, 0)]
25352538
25362539
sage: g = toric_varieties.Cube_deformation(10).fan().vertex_graph()
@@ -3319,18 +3322,19 @@ def oriented_boundary(self, cone):
33193322
33203323
EXAMPLES::
33213324
3322-
sage: fan = toric_varieties.P(3).fan() # needs palp
3323-
sage: cone = fan(2)[0] # needs palp
3324-
sage: bdry = fan.oriented_boundary(cone); bdry # needs palp
3325+
sage: # needs palp
3326+
sage: fan = toric_varieties.P(3).fan()
3327+
sage: cone = fan(2)[0]
3328+
sage: bdry = fan.oriented_boundary(cone); bdry
33253329
-1-d cone of Rational polyhedral fan in 3-d lattice N
33263330
+ 1-d cone of Rational polyhedral fan in 3-d lattice N
3327-
sage: bdry[0] # needs palp
3331+
sage: bdry[0]
33283332
(-1, 1-d cone of Rational polyhedral fan in 3-d lattice N)
3329-
sage: bdry[1] # needs palp
3333+
sage: bdry[1]
33303334
(1, 1-d cone of Rational polyhedral fan in 3-d lattice N)
3331-
sage: fan.oriented_boundary(bdry[0][1]) # needs palp
3335+
sage: fan.oriented_boundary(bdry[0][1])
33323336
-0-d cone of Rational polyhedral fan in 3-d lattice N
3333-
sage: fan.oriented_boundary(bdry[1][1]) # needs palp
3337+
sage: fan.oriented_boundary(bdry[1][1])
33343338
-0-d cone of Rational polyhedral fan in 3-d lattice N
33353339
33363340
If you pass the fan itself, this method returns the
@@ -3505,14 +3509,15 @@ def complex(self, base_ring=ZZ, extended=False):
35053509
35063510
EXAMPLES::
35073511
3508-
sage: fan = toric_varieties.P(3).fan() # needs palp
3509-
sage: K_normal = fan.complex(); K_normal # needs palp
3512+
sage: # needs palp
3513+
sage: fan = toric_varieties.P(3).fan()
3514+
sage: K_normal = fan.complex(); K_normal
35103515
Chain complex with at most 4 nonzero terms over Integer Ring
3511-
sage: K_normal.homology() # needs palp
3516+
sage: K_normal.homology()
35123517
{0: Z, 1: 0, 2: 0, 3: 0}
3513-
sage: K_extended = fan.complex(extended=True); K_extended # needs palp
3518+
sage: K_extended = fan.complex(extended=True); K_extended
35143519
Chain complex with at most 5 nonzero terms over Integer Ring
3515-
sage: K_extended.homology() # needs palp
3520+
sage: K_extended.homology()
35163521
{-1: 0, 0: 0, 1: 0, 2: 0, 3: 0}
35173522
35183523
Homology computations are much faster over `\QQ` if you do not

0 commit comments

Comments
 (0)