Skip to content

Commit 34ed89c

Browse files
committed
Linting the changes
1 parent 949c745 commit 34ed89c

File tree

3 files changed

+49
-52
lines changed

3 files changed

+49
-52
lines changed

src/sage/geometry/fan.py

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2439,14 +2439,15 @@ def Gale_transform(self):
24392439
m = m.augment(matrix(ZZ, m.nrows(), 1, [1] * m.nrows()))
24402440
return matrix(ZZ, m.integer_kernel().matrix())
24412441

2442-
def is_regular(self):
2442+
def is_polytopal(self):
24432443
r"""
2444-
Check if ``self`` is regular.
2444+
Check if ``self`` is the normal fan of a polytope.
24452445
2446-
A rational polyhedral fan is *regular* if it is the normal fan of a
2447-
polytope.
2446+
A rational polyhedral fan is *polytopal* if it is the normal fan of a
2447+
polytope. This is also called *regular*, or provide a *coherent*
2448+
subdivision or leads to a *projective* toric variety.
24482449
2449-
OUTPUT: ``True`` if ``self`` is complete and ``False`` otherwise
2450+
OUTPUT: ``True`` if ``self`` is polytopal and ``False`` otherwise
24502451
24512452
EXAMPLES:
24522453
@@ -2459,24 +2460,24 @@ def is_regular(self):
24592460
....: S1 = [Cone([rays[i] for i in indices]) for indices in L]
24602461
....: return Fan(S1)
24612462
2462-
When epsilon=0, it is not regular::
2463+
When epsilon=0, it is not polytopal::
24632464
24642465
sage: epsilon = 0
2465-
sage: mother(epsilon).is_regular()
2466+
sage: mother(epsilon).is_polytopal()
24662467
False
24672468
2468-
Doing a slight perturbation makes the same subdivision regular::
2469+
Doing a slight perturbation makes the same subdivision polytopal::
24692470
24702471
sage: epsilon = 1/2
2471-
sage: mother(epsilon).is_regular()
2472+
sage: mother(epsilon).is_polytopal()
24722473
True
24732474
24742475
.. SEEALSO::
24752476
24762477
:meth:`is_projective`.
24772478
"""
24782479
if not self.is_complete():
2479-
raise ValueError('the fan is not complete')
2480+
raise ValueError('To be polytopal, the fan should be complete.')
24802481
from sage.geometry.triangulation.point_configuration import PointConfiguration
24812482
from sage.geometry.polyhedron.constructor import Polyhedron
24822483
pc = PointConfiguration(self.rays())
@@ -2492,8 +2493,6 @@ def is_regular(self):
24922493
poly = Polyhedron(ieqs=ieqs)
24932494
return self.is_equivalent(poly.normal_fan())
24942495

2495-
is_projective = is_regular
2496-
24972496
def generating_cone(self, n):
24982497
r"""
24992498
Return the ``n``-th generating cone of ``self``.

src/sage/geometry/polyhedron/base5.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -711,19 +711,19 @@ def deformation_cone(self):
711711
2.2 of [ACEP2020].
712712
"""
713713
from .constructor import Polyhedron
714-
A = matrix([_.A() for _ in self.Hrepresentation()])
715-
A = A.transpose()
716-
A_ker = A.right_kernel_matrix(basis='computed')
717-
gale = tuple(A_ker.columns())
714+
m = matrix([_.A() for _ in self.Hrepresentation()])
715+
m = m.transpose()
716+
m_ker = m.right_kernel_matrix(basis='computed')
717+
gale = tuple(m_ker.columns())
718718
collection = [f.ambient_H_indices() for f in self.faces(0)]
719719
n = len(gale)
720-
K = None
720+
c = None
721721
for cone_indices in collection:
722722
dual_cone = Polyhedron(rays=[gale[i] for i in range(n) if i not in
723723
cone_indices])
724-
K = K.intersection(dual_cone) if K is not None else dual_cone
725-
preimages = [A_ker.solve_right(r.vector()) for r in K.rays()]
726-
return Polyhedron(lines=A.rows(), rays=preimages)
724+
c = c.intersection(dual_cone) if c is not None else dual_cone
725+
preimages = [A_ker.solve_right(r.vector()) for r in c.rays()]
726+
return Polyhedron(lines=m.rows(), rays=preimages)
727727

728728
###########################################################
729729
# Binary operations.

src/sage/geometry/triangulation/point_configuration.py

Lines changed: 30 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
(2, 3, 4)
6262
sage: list(t)
6363
[(1, 3, 4), (2, 3, 4)]
64-
sage: t.plot(axes=False) # needs sage.plot
64+
sage: t.plot(axes=False) # needs sage.plot
6565
Graphics object consisting of 12 graphics primitives
6666
6767
.. PLOT::
@@ -91,7 +91,7 @@
9191
sage: p = [[0,-1,-1], [0,0,1], [0,1,0], [1,-1,-1], [1,0,1], [1,1,0]]
9292
sage: points = PointConfiguration(p)
9393
sage: triang = points.triangulate()
94-
sage: triang.plot(axes=False) # needs sage.plot
94+
sage: triang.plot(axes=False) # needs sage.plot
9595
Graphics3d Object
9696
9797
.. PLOT::
@@ -116,7 +116,7 @@
116116
16
117117
sage: len(nonregular)
118118
2
119-
sage: nonregular[0].plot(aspect_ratio=1, axes=False) # needs sage.plot
119+
sage: nonregular[0].plot(aspect_ratio=1, axes=False) # needs sage.plot
120120
Graphics object consisting of 25 graphics primitives
121121
sage: PointConfiguration.set_engine('internal') # to make doctests independent of TOPCOM
122122
@@ -1131,20 +1131,20 @@ def restricted_automorphism_group(self):
11311131
11321132
sage: pyramid = PointConfiguration([[1,0,0], [0,1,1], [0,1,-1],
11331133
....: [0,-1,-1], [0,-1,1]])
1134-
sage: G = pyramid.restricted_automorphism_group() # needs sage.graphs sage.groups
1135-
sage: G == PermutationGroup([[(3,5)], [(2,3),(4,5)], [(2,4)]]) # needs sage.graphs sage.groups
1134+
sage: G = pyramid.restricted_automorphism_group() # needs sage.graphs sage.groups
1135+
sage: G == PermutationGroup([[(3,5)], [(2,3),(4,5)], [(2,4)]]) # needs sage.graphs sage.groups
11361136
True
1137-
sage: DihedralGroup(4).is_isomorphic(G) # needs sage.graphs sage.groups
1137+
sage: DihedralGroup(4).is_isomorphic(G) # needs sage.graphs sage.groups
11381138
True
11391139
11401140
The square with an off-center point in the middle. Note that
11411141
the middle point breaks the restricted automorphism group
11421142
`D_4` of the convex hull::
11431143
11441144
sage: square = PointConfiguration([(3/4,3/4), (1,1), (1,-1), (-1,-1), (-1,1)])
1145-
sage: square.restricted_automorphism_group() # needs sage.graphs sage.groups
1145+
sage: square.restricted_automorphism_group() # needs sage.graphs sage.groups
11461146
Permutation Group with generators [(3,5)]
1147-
sage: DihedralGroup(1).is_isomorphic(_) # needs sage.graphs sage.groups
1147+
sage: DihedralGroup(1).is_isomorphic(_) # needs sage.graphs sage.groups
11481148
True
11491149
"""
11501150
v_list = [ vector(p.projective()) for p in self ]
@@ -1532,9 +1532,9 @@ def bistellar_flips(self):
15321532
sage: pc.bistellar_flips()
15331533
(((<0,1,3>, <0,2,3>), (<0,1,2>, <1,2,3>)),)
15341534
sage: Tpos, Tneg = pc.bistellar_flips()[0]
1535-
sage: Tpos.plot(axes=False) # needs sage.plot
1535+
sage: Tpos.plot(axes=False) # needs sage.plot
15361536
Graphics object consisting of 11 graphics primitives
1537-
sage: Tneg.plot(axes=False) # needs sage.plot
1537+
sage: Tneg.plot(axes=False) # needs sage.plot
15381538
Graphics object consisting of 11 graphics primitives
15391539
15401540
The 3d analog::
@@ -1549,7 +1549,7 @@ def bistellar_flips(self):
15491549
sage: pc.bistellar_flips()
15501550
(((<0,1,3>, <0,2,3>), (<0,1,2>, <1,2,3>)),)
15511551
sage: Tpos, Tneg = pc.bistellar_flips()[0]
1552-
sage: Tpos.plot(axes=False) # needs sage.plot
1552+
sage: Tpos.plot(axes=False) # needs sage.plot
15531553
Graphics3d Object
15541554
"""
15551555
flips = []
@@ -2080,7 +2080,7 @@ def Gale_transform(self, points=None, homogenize=True):
20802080
[ 1 1 1 0 -3]
20812081
[ 0 2 2 -1 -3]
20822082
2083-
It might not affect the dimension of the result::
2083+
It might not affect the dimension of the result::
20842084
20852085
sage: PC = PointConfiguration([[4,0,0],[0,4,0],[0,0,4],[2,1,1],[1,2,1],[1,1,2]])
20862086
sage: GT = PC.Gale_transform(homogenize=False);GT
@@ -2136,9 +2136,9 @@ def deformation_cone(self, collection):
21362136
- ``collection`` -- a collection of subconfigurations of ``self``.
21372137
Subconfigurations are given as indices
21382138
2139-
OUTPUT: a polyhedron. It contains the liftings of the point configuration
2140-
making the collection a regular (or coherent, or projective)
2141-
subdivision.
2139+
OUTPUT: a polyhedron. It contains the liftings of the point configuration
2140+
making the collection a regular (or coherent, or projective, or
2141+
polytopal) subdivision.
21422142
21432143
EXAMPLES::
21442144
@@ -2170,58 +2170,56 @@ def deformation_cone(self, collection):
21702170
Let's verify the mother of all examples explained in Section 7.1.1 of
21712171
[DLRS2010]_::
21722172
2173+
sage: def mother(epsilon=0):
2174+
....: return PointConfiguration([(4-epsilon,epsilon,0),(0,4-epsilon,epsilon),(epsilon,0,4-epsilon),(2,1,1),(1,2,1),(1,1,2)])
2175+
21732176
sage: epsilon = 0
2174-
sage: mother = PointConfiguration([(4-epsilon,epsilon,0),(0,4-epsilon,epsilon),(epsilon,0,4-epsilon),(2,1,1),(1,2,1),(1,1,2)])
2177+
sage: m = mother(0)
21752178
sage: mother.points()
21762179
(P(4, 0, 0), P(0, 4, 0), P(0, 0, 4), P(2, 1, 1), P(1, 2, 1), P(1, 1, 2))
21772180
sage: S1 = [(0,1,4),(0,3,4),(1,2,5),(1,4,5),(0,2,3),(2,3,5)]
21782181
sage: S2 = [(0,1,3),(1,3,4),(1,2,4),(2,4,5),(0,2,5),(0,3,5)]
21792182
21802183
Both subdivisions `S1` and `S2` are not regular::
21812184
2182-
sage: mother_dc1 = mother.deformation_cone(S1)
2185+
sage: mother_dc1 = m.deformation_cone(S1)
21832186
sage: mother_dc1
21842187
A 4-dimensional polyhedron in QQ^6 defined as the convex hull of 1 vertex, 1 ray, 3 lines
2185-
sage: mother_dc2 = mother.deformation_cone(S2)
2188+
sage: mother_dc2 = m.deformation_cone(S2)
21862189
sage: mother_dc2
21872190
A 4-dimensional polyhedron in QQ^6 defined as the convex hull of 1 vertex, 1 ray, 3 lines
21882191
21892192
Notice that they have a ray which provides a degenerate lifting which
21902193
only provides a coarsening of the subdivision from the lower hull (it
21912194
has 5 facets, and should have 8)::
21922195
2193-
sage: result = Polyhedron([vector(list(mother.points()[_])+[mother_dc1.rays()[0][_]]) for _ in range(len(mother.points()))])
2196+
sage: result = Polyhedron([vector(list(m.points()[_])+[mother_dc1.rays()[0][_]]) for _ in range(len(m.points()))])
21942197
sage: result.f_vector()
21952198
(1, 6, 9, 5, 1)
21962199
21972200
But if we use epsilon to perturb the configuration, suddenly
21982201
`S1` becomes regular::
21992202
22002203
sage: epsilon = 1/2
2201-
sage: mother = PointConfiguration([(4-epsilon,epsilon,0),
2202-
(0,4-epsilon,epsilon),
2203-
(epsilon,0,4-epsilon),
2204-
(2,1,1),
2205-
(1,2,1),
2206-
(1,1,2)])
2207-
sage: mother.points()
2204+
sage: mp = mother(epsilon)
2205+
sage: mp.points()
22082206
(P(7/2, 1/2, 0),
22092207
P(0, 7/2, 1/2),
22102208
P(1/2, 0, 7/2),
22112209
P(2, 1, 1),
22122210
P(1, 2, 1),
22132211
P(1, 1, 2))
2214-
sage: mother_dc1 = mother.deformation_cone(S1);mother_dc1
2212+
sage: mother_dc1 = mp.deformation_cone(S1);mother_dc1
22152213
A 6-dimensional polyhedron in QQ^6 defined as the convex hull of 1 vertex, 3 rays, 3 lines
2216-
sage: mother_dc2 = mother.deformation_cone(S2);mother_dc2
2214+
sage: mother_dc2 = mp.deformation_cone(S2);mother_dc2
22172215
A 3-dimensional polyhedron in QQ^6 defined as the convex hull of 1 vertex and 3 lines
22182216
2219-
.. SEEALSO::
2220-
2217+
.. SEEALSO::
2218+
22212219
:meth:`~sage.schemes.toric.variety.Kaehler_cone`
2222-
2220+
22232221
REFERENCES:
2224-
2222+
22252223
For more information, see Section 5.4 of [DLRS2010]_ and Section
22262224
2.2 of [ACEP2020].
22272225
"""

0 commit comments

Comments
 (0)