Skip to content

Commit b27a7ba

Browse files
committed
Added the missing methods
1 parent 6531546 commit b27a7ba

File tree

3 files changed

+120
-3
lines changed

3 files changed

+120
-3
lines changed

src/sage/geometry/fan.py

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2439,6 +2439,58 @@ 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):
2443+
r"""
2444+
Check if ``self`` is regular.
2445+
2446+
A rational polyhedral fan is *regular* if it is the normal fan of a
2447+
polytope.
2448+
2449+
OUTPUT: ``True`` if ``self`` is complete and ``False`` otherwise
2450+
2451+
EXAMPLES:
2452+
2453+
This is the mother of all examples, which is not regular (see Section
2454+
7.1.1 in [DLRS2010]_)::
2455+
2456+
sage: epsilon = 0
2457+
sage: rays = [(4-epsilon,epsilon,0),(0,4-epsilon,epsilon),(epsilon,0,4-epsilon),(2,1,1),(1,2,1),(1,1,2),(-1,-1,-1)]
2458+
sage: S1 = [Cone([rays[i] for i in indices]) for indices in [(0,1,4),(0,3,4),(1,2,5),(1,4,5),(0,2,3),(2,3,5),(3,4,5),(6,0,1),(6,1,2),(6,2,0)]]
2459+
sage: mother = Fan(S1)
2460+
sage: mother.is_regular()
2461+
False
2462+
2463+
Doing a slight perturbation makes the same subdivision regular::
2464+
2465+
sage: epsilon = 1/2
2466+
sage: rays = [(4-epsilon,epsilon,0),(0,4-epsilon,epsilon),(epsilon,0,4-epsilon),(2,1,1),(1,2,1),(1,1,2),(-1,-1,-1)]
2467+
sage: S1 = [Cone([rays[i] for i in indices]) for indices in [(0,1,4),(0,3,4),(1,2,5),(1,4,5),(0,2,3),(2,3,5),(3,4,5),(6,0,1),(6,1,2),(6,2,0)]]
2468+
sage: mother = Fan(S1)
2469+
sage: mother.is_regular()
2470+
True
2471+
2472+
.. SEEALSO::
2473+
2474+
:meth:`is_projective`.
2475+
"""
2476+
if not self.is_complete():
2477+
raise ValueError('the fan is not complete')
2478+
from sage.geometry.triangulation.point_configuration import PointConfiguration
2479+
from sage.geometry.polyhedron.constructor import Polyhedron
2480+
pc = PointConfiguration(self.rays())
2481+
v_pc = [vector(pc.point(i)) for i in range(pc.n_points())]
2482+
v_r = [vector(list(r)) for r in self.rays()]
2483+
cone_indices = [_.ambient_ray_indices() for _ in self.generating_cones()]
2484+
translator = [v_pc.index(v_r[i]) for i in range(pc.n_points())]
2485+
translated_cone_indices = [[translator[i] for i in ci] for ci in cone_indices]
2486+
dc_pc = pc.deformation_cone(translated_cone_indices)
2487+
lift = dc_pc.an_element()
2488+
ieqs = [[lift[i]] + list(v_pc[i]) for i in range(self.nrays())]
2489+
poly = Polyhedron(ieqs=ieqs)
2490+
return self.is_equivalent(poly.normal_fan())
2491+
2492+
is_projective = is_regular
2493+
24422494
def generating_cone(self, n):
24432495
r"""
24442496
Return the ``n``-th generating cone of ``self``.

src/sage/geometry/polyhedron/base5.py

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -669,7 +669,10 @@ def deformation_cone(self):
669669
that the resulting polytope has a normal fan which is a coarsening of
670670
the normal fan of ``self``.
671671
672-
EXAMPLES::
672+
EXAMPLES:
673+
674+
Let's examine the deformation cone of the square with one truncated
675+
vertex::
673676
674677
sage: tc = Polyhedron([(1, -1), (1/3, 1), (1, 1/3), (-1, 1), (-1, -1)])
675678
sage: dc = tc.deformation_cone()
@@ -685,6 +688,19 @@ def deformation_cone(self):
685688
A ray in the direction (0, 1, 1),
686689
A ray in the direction (1, 0, 2))
687690
691+
Now, let's compute the deformation cone of the pyramid over a square
692+
and verify that it is not full dimensional::
693+
694+
sage: py = Polyhedron([(0, -1, -1), (0, -1, 1), (0, 1, -1), (0, 1, 1), (1, 0, 0)])
695+
sage: dc_py = py.deformation_cone(); dc_py
696+
A 4-dimensional polyhedron in QQ^5 defined as the convex hull of 1 vertex, 1 ray, 3 lines
697+
sage: [_.b() for _ in py.Hrepresentation()]
698+
[0, 1, 1, 1, 1]
699+
sage: r = dc_py.rays()[0]
700+
sage: l1,l2,l3 = dc_py.lines()
701+
sage: r.vector()-l1.vector()/2-l2.vector()-l3.vector()/2
702+
(0, 1, 1, 1, 1)
703+
688704
.. SEEALSO::
689705
690706
:meth:`~sage.schemes.toric.variety.Kaehler_cone`
@@ -699,7 +715,7 @@ def deformation_cone(self):
699715
A = A.transpose()
700716
A_ker = A.right_kernel_matrix(basis='computed')
701717
gale = tuple(A_ker.columns())
702-
collection = [_.ambient_H_indices() for _ in self.faces(0)]
718+
collection = [f.ambient_H_indices() for f in self.faces(0)]
703719
n = len(gale)
704720
K = None
705721
for cone_indices in collection:

src/sage/geometry/triangulation/point_configuration.py

Lines changed: 50 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2121,7 +2121,7 @@ def Gale_transform(self, points=None, homogenize=True):
21212121
except TypeError:
21222122
pass
21232123
if homogenize:
2124-
m = matrix([ (1,) + p.affine() for p in points])
2124+
m = matrix([(1,) + p.affine() for p in points])
21252125
else:
21262126
m = matrix([p.affine() for p in points])
21272127
return m.left_kernel().matrix()
@@ -2167,6 +2167,55 @@ def deformation_cone(self, collection):
21672167
A ray in the direction (0, 1, 0),
21682168
A ray in the direction (1, 0, -1))
21692169
2170+
Let's verify the mother of all examples explained in Section 7.1.1 of
2171+
[DLRS2010]_::
2172+
2173+
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)])
2175+
sage: mother.points()
2176+
(P(4, 0, 0), P(0, 4, 0), P(0, 0, 4), P(2, 1, 1), P(1, 2, 1), P(1, 1, 2))
2177+
sage: S1 = [(0,1,4),(0,3,4),(1,2,5),(1,4,5),(0,2,3),(2,3,5)]
2178+
sage: S2 = [(0,1,3),(1,3,4),(1,2,4),(2,4,5),(0,2,5),(0,3,5)]
2179+
2180+
Both subdivisions `S1` and `S2` are not regular::
2181+
2182+
sage: mother_dc1 = mother.deformation_cone(S1)
2183+
sage: mother_dc1
2184+
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)
2186+
sage: mother_dc2
2187+
A 4-dimensional polyhedron in QQ^6 defined as the convex hull of 1 vertex, 1 ray, 3 lines
2188+
2189+
Notice that they have a ray which provides a degenerate lifting which
2190+
only provides a coarsening of the subdivision from the lower hull (it
2191+
has 5 facets, and should have 8)::
2192+
2193+
sage: result = Polyhedron([vector(list(mother.points()[_])+[mother_dc1.rays()[0][_]]) for _ in range(len(mother.points()))])
2194+
sage: result.f_vector()
2195+
(1, 6, 9, 5, 1)
2196+
2197+
But if we use epsilon to perturb the configuration, suddenly
2198+
`S1` becomes regular::
2199+
2200+
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()
2208+
(P(7/2, 1/2, 0),
2209+
P(0, 7/2, 1/2),
2210+
P(1/2, 0, 7/2),
2211+
P(2, 1, 1),
2212+
P(1, 2, 1),
2213+
P(1, 1, 2))
2214+
sage: mother_dc1 = mother.deformation_cone(S1);mother_dc1
2215+
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
2217+
A 3-dimensional polyhedron in QQ^6 defined as the convex hull of 1 vertex and 3 lines
2218+
21702219
.. SEEALSO::
21712220
21722221
:meth:`~sage.schemes.toric.variety.Kaehler_cone`

0 commit comments

Comments
 (0)