Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
src/sage/geometry/lattice_polytope.py, src/sage/schemes/toric/fano_va…
Browse files Browse the repository at this point in the history
…riety.py: Use unicode disjoint union symbol
  • Loading branch information
Matthias Koeppe authored and dimpase committed Mar 7, 2022
1 parent 4145202 commit 45edf72
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 72 deletions.
132 changes: 66 additions & 66 deletions src/sage/geometry/lattice_polytope.py
Original file line number Diff line number Diff line change
Expand Up @@ -1229,9 +1229,9 @@ def _read_nef_partitions(self, data):
sage: o_copy._read_nef_partitions(s) # optional - palp
sage: o_copy._nef_partitions # optional - palp
[
Nef-partition {0, 1, 3} U {2, 4, 5},
Nef-partition {0, 1, 2} U {3, 4, 5},
Nef-partition {0, 1, 2, 3} U {4, 5}
Nef-partition {0, 1, 3} {2, 4, 5},
Nef-partition {0, 1, 2} {3, 4, 5},
Nef-partition {0, 1, 2, 3} {4, 5}
]
"""
if isinstance(data, str):
Expand Down Expand Up @@ -2722,27 +2722,27 @@ def nef_partitions(self, keep_symmetric=False, keep_products=True,
sage: p = lattice_polytope.cross_polytope(4)
sage: p.nef_partitions() # optional - palp
[
Nef-partition {0, 1, 4, 5} U {2, 3, 6, 7} (direct product),
Nef-partition {0, 1, 2, 4} U {3, 5, 6, 7},
Nef-partition {0, 1, 2, 4, 5} U {3, 6, 7},
Nef-partition {0, 1, 2, 4, 5, 6} U {3, 7} (direct product),
Nef-partition {0, 1, 2, 3} U {4, 5, 6, 7},
Nef-partition {0, 1, 2, 3, 4} U {5, 6, 7},
Nef-partition {0, 1, 2, 3, 4, 5} U {6, 7},
Nef-partition {0, 1, 2, 3, 4, 5, 6} U {7} (projection)
Nef-partition {0, 1, 4, 5} {2, 3, 6, 7} (direct product),
Nef-partition {0, 1, 2, 4} {3, 5, 6, 7},
Nef-partition {0, 1, 2, 4, 5} {3, 6, 7},
Nef-partition {0, 1, 2, 4, 5, 6} {3, 7} (direct product),
Nef-partition {0, 1, 2, 3} {4, 5, 6, 7},
Nef-partition {0, 1, 2, 3, 4} {5, 6, 7},
Nef-partition {0, 1, 2, 3, 4, 5} {6, 7},
Nef-partition {0, 1, 2, 3, 4, 5, 6} {7} (projection)
]
Now we omit projections::
sage: p.nef_partitions(keep_projections=False) # optional - palp
[
Nef-partition {0, 1, 4, 5} U {2, 3, 6, 7} (direct product),
Nef-partition {0, 1, 2, 4} U {3, 5, 6, 7},
Nef-partition {0, 1, 2, 4, 5} U {3, 6, 7},
Nef-partition {0, 1, 2, 4, 5, 6} U {3, 7} (direct product),
Nef-partition {0, 1, 2, 3} U {4, 5, 6, 7},
Nef-partition {0, 1, 2, 3, 4} U {5, 6, 7},
Nef-partition {0, 1, 2, 3, 4, 5} U {6, 7}
Nef-partition {0, 1, 4, 5} {2, 3, 6, 7} (direct product),
Nef-partition {0, 1, 2, 4} {3, 5, 6, 7},
Nef-partition {0, 1, 2, 4, 5} {3, 6, 7},
Nef-partition {0, 1, 2, 4, 5, 6} {3, 7} (direct product),
Nef-partition {0, 1, 2, 3} {4, 5, 6, 7},
Nef-partition {0, 1, 2, 3, 4} {5, 6, 7},
Nef-partition {0, 1, 2, 3, 4, 5} {6, 7}
]
Currently Hodge numbers cannot be computed for a given nef-partition::
Expand All @@ -2757,14 +2757,14 @@ def nef_partitions(self, keep_symmetric=False, keep_products=True,
sage: p.nef_partitions(hodge_numbers=True) # long time (2s on sage.math, 2011) # optional - palp
[
Nef-partition {0, 1, 4, 5} U {2, 3, 6, 7} (direct product),
Nef-partition {0, 1, 2, 4} U {3, 5, 6, 7},
Nef-partition {0, 1, 2, 4, 5} U {3, 6, 7},
Nef-partition {0, 1, 2, 4, 5, 6} U {3, 7} (direct product),
Nef-partition {0, 1, 2, 3} U {4, 5, 6, 7},
Nef-partition {0, 1, 2, 3, 4} U {5, 6, 7},
Nef-partition {0, 1, 2, 3, 4, 5} U {6, 7},
Nef-partition {0, 1, 2, 3, 4, 5, 6} U {7} (projection)
Nef-partition {0, 1, 4, 5} {2, 3, 6, 7} (direct product),
Nef-partition {0, 1, 2, 4} {3, 5, 6, 7},
Nef-partition {0, 1, 2, 4, 5} {3, 6, 7},
Nef-partition {0, 1, 2, 4, 5, 6} {3, 7} (direct product),
Nef-partition {0, 1, 2, 3} {4, 5, 6, 7},
Nef-partition {0, 1, 2, 3, 4} {5, 6, 7},
Nef-partition {0, 1, 2, 3, 4, 5} {6, 7},
Nef-partition {0, 1, 2, 3, 4, 5, 6} {7} (projection)
]
Now it is possible to get Hodge numbers::
Expand All @@ -2784,19 +2784,19 @@ def nef_partitions(self, keep_symmetric=False, keep_products=True,
sage: p = lattice_polytope.cross_polytope(2)
sage: p.nef_partitions() # optional - palp
[
Nef-partition {0, 2} U {1, 3} (direct product),
Nef-partition {0, 1} U {2, 3},
Nef-partition {0, 1, 2} U {3} (projection)
Nef-partition {0, 2} {1, 3} (direct product),
Nef-partition {0, 1} {2, 3},
Nef-partition {0, 1, 2} {3} (projection)
]
sage: p.nef_partitions(keep_symmetric=True) # optional - palp
[
Nef-partition {0, 1, 3} U {2} (projection),
Nef-partition {0, 2, 3} U {1} (projection),
Nef-partition {0, 3} U {1, 2},
Nef-partition {1, 2, 3} U {0} (projection),
Nef-partition {1, 3} U {0, 2} (direct product),
Nef-partition {2, 3} U {0, 1},
Nef-partition {0, 1, 2} U {3} (projection)
Nef-partition {0, 1, 3} {2} (projection),
Nef-partition {0, 2, 3} {1} (projection),
Nef-partition {0, 3} {1, 2},
Nef-partition {1, 2, 3} {0} (projection),
Nef-partition {1, 3} {0, 2} (direct product),
Nef-partition {2, 3} {0, 1},
Nef-partition {0, 1, 2} {3} (projection)
]
Nef-partitions can be computed only for reflexive polytopes::
Expand Down Expand Up @@ -4194,7 +4194,7 @@ def is_NefPartition(x):
False
sage: o = lattice_polytope.cross_polytope(3)
sage: np = o.nef_partitions()[0]; np # optional - palp
Nef-partition {0, 1, 3} U {2, 4, 5}
Nef-partition {0, 1, 3} {2, 4, 5}
sage: is_NefPartition(np) # optional - palp
True
"""
Expand Down Expand Up @@ -4292,7 +4292,7 @@ class NefPartition(SageObject, Hashable):
sage: o = lattice_polytope.cross_polytope(3)
sage: np = NefPartition([0,0,1,2,2,1], o)
sage: np
Nef-partition {0, 1} U {2, 5} U {3, 4}
Nef-partition {0, 1} {2, 5} {3, 4}
The octahedron plays the role of `\Delta^\circ` in the above description::
Expand All @@ -4303,7 +4303,7 @@ class NefPartition(SageObject, Hashable):
intersection") gives decomposition of the vertex set of `\nabla^\circ`::
sage: np.dual()
Nef-partition {0, 1, 2} U {3, 4} U {5, 6, 7}
Nef-partition {0, 1, 2} {3, 4} {5, 6, 7}
sage: np.nabla_polar().vertices()
N(-1, -1, 0),
N(-1, 0, 0),
Expand Down Expand Up @@ -4335,11 +4335,11 @@ class NefPartition(SageObject, Hashable):
sage: o.nef_partitions() # optional - palp
[
Nef-partition {0, 1, 3} U {2, 4, 5},
Nef-partition {0, 1, 3, 4} U {2, 5} (direct product),
Nef-partition {0, 1, 2} U {3, 4, 5},
Nef-partition {0, 1, 2, 3} U {4, 5},
Nef-partition {0, 1, 2, 3, 4} U {5} (projection)
Nef-partition {0, 1, 3} {2, 4, 5},
Nef-partition {0, 1, 3, 4} {2, 5} (direct product),
Nef-partition {0, 1, 2} {3, 4, 5},
Nef-partition {0, 1, 2, 3} {4, 5},
Nef-partition {0, 1, 2, 3, 4} {5} (projection)
]
"""

Expand Down Expand Up @@ -4504,12 +4504,12 @@ def _repr_(self):
sage: o = lattice_polytope.cross_polytope(3)
sage: np = NefPartition([0, 0, 1, 0, 1, 1], o)
sage: repr(np) # indirect doctest
'Nef-partition {0, 1, 3} U {2, 4, 5}'
'Nef-partition {0, 1, 3} {2, 4, 5}'
"""
result = "Nef-partition "
for i, part in enumerate(self.parts()):
if i != 0:
result += " U "
result += " "
result += "{" + ", ".join("%d" % v for v in part) + "}"
try:
# We may or may not know the type of the partition
Expand All @@ -4531,7 +4531,7 @@ def _sage_input_(self, sib, coerced):
sage: o = lattice_polytope.cross_polytope(3)
sage: np = NefPartition([0, 0, 1, 0, 1, 1], o); np
Nef-partition {0, 1, 3} U {2, 4, 5}
Nef-partition {0, 1, 3} {2, 4, 5}
sage: sage_input(np, verify=True)
# Verified
NefPartition([0, 0, 1, 0, 1, 1],
Expand Down Expand Up @@ -4565,7 +4565,7 @@ def Delta(self, i=None):
sage: o = lattice_polytope.cross_polytope(3)
sage: np = NefPartition([0, 0, 1, 0, 1, 1], o); np
Nef-partition {0, 1, 3} U {2, 4, 5}
Nef-partition {0, 1, 3} {2, 4, 5}
sage: np.Delta().polar() is o
True
sage: np.Delta().vertices()
Expand Down Expand Up @@ -4605,7 +4605,7 @@ def Delta_polar(self):
sage: o = lattice_polytope.cross_polytope(3)
sage: np = NefPartition([0, 0, 1, 0, 1, 1], o); np
Nef-partition {0, 1, 3} U {2, 4, 5}
Nef-partition {0, 1, 3} {2, 4, 5}
sage: np.Delta_polar() is o
True
"""
Expand All @@ -4626,7 +4626,7 @@ def Deltas(self):
sage: o = lattice_polytope.cross_polytope(3)
sage: np = NefPartition([0, 0, 1, 0, 1, 1], o); np
Nef-partition {0, 1, 3} U {2, 4, 5}
Nef-partition {0, 1, 3} {2, 4, 5}
sage: np.Delta().vertices()
N( 1, -1, -1),
N( 1, 1, -1),
Expand Down Expand Up @@ -4686,9 +4686,9 @@ def dual(self):
sage: o = lattice_polytope.cross_polytope(3)
sage: np = NefPartition([0, 0, 1, 0, 1, 1], o); np
Nef-partition {0, 1, 3} U {2, 4, 5}
Nef-partition {0, 1, 3} {2, 4, 5}
sage: np.dual()
Nef-partition {0, 1, 2, 3} U {4, 5, 6, 7}
Nef-partition {0, 1, 2, 3} {4, 5, 6, 7}
sage: np.dual().Delta() is np.nabla()
True
sage: np.dual().nabla(0) is np.Delta(0)
Expand All @@ -4708,7 +4708,7 @@ def dual(self):
if min(row) == -1:
vertex_to_part.append(i)
nabla_polar_vertices.append(nabla_polar.vertex(j))
# Make dual look "ordered", like {0,1,2} U {3,4,5,6} U {7,8}.
# Make dual look "ordered", like {0,1,2} {3,4,5,6} {7,8}.
nabla_polar = LatticePolytope(nabla_polar_vertices,
compute_vertices=False)
# If self is a valid nef-partition, the dual is as well.
Expand Down Expand Up @@ -4764,7 +4764,7 @@ def nabla(self, i=None):
sage: o = lattice_polytope.cross_polytope(3)
sage: np = NefPartition([0, 0, 1, 0, 1, 1], o); np
Nef-partition {0, 1, 3} U {2, 4, 5}
Nef-partition {0, 1, 3} {2, 4, 5}
sage: np.Delta_polar().vertices()
M( 1, 0, 0),
M( 0, 1, 0),
Expand Down Expand Up @@ -4809,7 +4809,7 @@ def nabla_polar(self):
sage: o = lattice_polytope.cross_polytope(3)
sage: np = NefPartition([0, 0, 1, 0, 1, 1], o); np
Nef-partition {0, 1, 3} U {2, 4, 5}
Nef-partition {0, 1, 3} {2, 4, 5}
sage: np.nabla_polar().vertices()
N(-1, -1, 0),
N( 1, -1, 0),
Expand Down Expand Up @@ -4840,7 +4840,7 @@ def nablas(self):
sage: o = lattice_polytope.cross_polytope(3)
sage: np = NefPartition([0, 0, 1, 0, 1, 1], o); np
Nef-partition {0, 1, 3} U {2, 4, 5}
Nef-partition {0, 1, 3} {2, 4, 5}
sage: np.Delta_polar().vertices()
M( 1, 0, 0),
M( 0, 1, 0),
Expand Down Expand Up @@ -4882,7 +4882,7 @@ def nparts(self):
sage: o = lattice_polytope.cross_polytope(3)
sage: np = NefPartition([0, 0, 1, 0, 1, 1], o); np
Nef-partition {0, 1, 3} U {2, 4, 5}
Nef-partition {0, 1, 3} {2, 4, 5}
sage: np.nparts()
2
"""
Expand Down Expand Up @@ -4911,7 +4911,7 @@ def part(self, i, all_points=False):
sage: o = lattice_polytope.cross_polytope(3)
sage: np = NefPartition([0, 0, 1, 0, 1, 1], o); np
Nef-partition {0, 1, 3} U {2, 4, 5}
Nef-partition {0, 1, 3} {2, 4, 5}
sage: np.part(0)
(0, 1, 3)
sage: np.part(0, all_points=True) # optional - palp
Expand Down Expand Up @@ -4945,7 +4945,7 @@ def parts(self, all_points=False):
sage: o = lattice_polytope.cross_polytope(3)
sage: np = NefPartition([0, 0, 1, 0, 1, 1], o); np
Nef-partition {0, 1, 3} U {2, 4, 5}
Nef-partition {0, 1, 3} {2, 4, 5}
sage: np.parts()
((0, 1, 3), (2, 4, 5))
sage: np.parts(all_points=True) # optional - palp
Expand Down Expand Up @@ -4985,7 +4985,7 @@ def part_of(self, i):
sage: o = lattice_polytope.cross_polytope(3)
sage: np = NefPartition([0, 0, 1, 0, 1, 1], o); np
Nef-partition {0, 1, 3} U {2, 4, 5}
Nef-partition {0, 1, 3} {2, 4, 5}
sage: np.part_of(3)
0
sage: np.part_of(2)
Expand Down Expand Up @@ -5027,7 +5027,7 @@ def part_of_point(self, i):
sage: p = LatticePolytope([(1,0,0), (0,1,0), (0,0,1), (0,1,-1),
....: (0,-1,1), (-1,1,0), (0,-1,-1), (-1,-1,0), (-1,-1,2)])
sage: np = p.nef_partitions()[0]; np # optional - palp
Nef-partition {1, 2, 5, 7, 8} U {0, 3, 4, 6}
Nef-partition {1, 2, 5, 7, 8} {0, 3, 4, 6}
sage: p.nvertices()
9
sage: p.npoints() # optional - palp
Expand Down Expand Up @@ -5413,11 +5413,11 @@ def all_nef_partitions(polytopes, keep_symmetric=False):
sage: lattice_polytope.all_nef_partitions([o]) # optional - palp
sage: o.nef_partitions() # optional - palp
[
Nef-partition {0, 1, 3} U {2, 4, 5},
Nef-partition {0, 1, 3, 4} U {2, 5} (direct product),
Nef-partition {0, 1, 2} U {3, 4, 5},
Nef-partition {0, 1, 2, 3} U {4, 5},
Nef-partition {0, 1, 2, 3, 4} U {5} (projection)
Nef-partition {0, 1, 3} {2, 4, 5},
Nef-partition {0, 1, 3, 4} {2, 5} (direct product),
Nef-partition {0, 1, 2} {3, 4, 5},
Nef-partition {0, 1, 2, 3} {4, 5},
Nef-partition {0, 1, 2, 3, 4} {5} (projection)
]
You cannot use this function for non-reflexive polytopes::
Expand Down
12 changes: 6 additions & 6 deletions src/sage/schemes/toric/fano_variety.py
Original file line number Diff line number Diff line change
Expand Up @@ -1120,7 +1120,7 @@ def nef_complete_intersection(self, nef_partition, **kwds):
sage: p = ReflexivePolytope(3, 2254)
sage: np = p.nef_partitions()[1]
sage: np
Nef-partition {2, 3, 4, 7, 8} U {0, 1, 5, 6}
Nef-partition {2, 3, 4, 7, 8} {0, 1, 5, 6}
sage: X = CPRFanoToricVariety(Delta_polar=p)
sage: X.nef_complete_intersection(np)
Closed subscheme of 3-d CPR-Fano toric variety
Expand Down Expand Up @@ -1469,7 +1469,7 @@ class NefCompleteIntersection(AlgebraicScheme_subscheme_toric):
sage: o = lattice_polytope.cross_polytope(3)
sage: np = o.nef_partitions()[0]
sage: np
Nef-partition {0, 1, 3} U {2, 4, 5}
Nef-partition {0, 1, 3} {2, 4, 5}
sage: X = CPRFanoToricVariety(Delta_polar=o)
sage: X.nef_complete_intersection(np)
Closed subscheme of 3-d CPR-Fano toric variety
Expand All @@ -1494,7 +1494,7 @@ def __init__(self, P_Delta, nef_partition,
sage: o = lattice_polytope.cross_polytope(3)
sage: np = o.nef_partitions()[0]
sage: np
Nef-partition {0, 1, 3} U {2, 4, 5}
Nef-partition {0, 1, 3} {2, 4, 5}
sage: X = CPRFanoToricVariety(Delta_polar=o)
sage: from sage.schemes.toric.fano_variety import *
sage: NefCompleteIntersection(X, np)
Expand Down Expand Up @@ -1592,7 +1592,7 @@ def cohomology_class(self):
sage: o = lattice_polytope.cross_polytope(3)
sage: np = o.nef_partitions()[0]
sage: np
Nef-partition {0, 1, 3} U {2, 4, 5}
Nef-partition {0, 1, 3} {2, 4, 5}
sage: X = CPRFanoToricVariety(Delta_polar=o)
sage: CI = X.nef_complete_intersection(np)
sage: CI
Expand Down Expand Up @@ -1625,7 +1625,7 @@ def nef_partition(self):
sage: o = lattice_polytope.cross_polytope(3)
sage: np = o.nef_partitions()[0]
sage: np
Nef-partition {0, 1, 3} U {2, 4, 5}
Nef-partition {0, 1, 3} {2, 4, 5}
sage: X = CPRFanoToricVariety(Delta_polar=o)
sage: CI = X.nef_complete_intersection(np)
sage: CI
Expand All @@ -1636,7 +1636,7 @@ def nef_partition(self):
b1*z1*z2^2 + b2*z2^2*z4 + b5*z1*z2*z5
+ b4*z2*z4*z5 + b3*z1*z5^2 + b0*z4*z5^2
sage: CI.nef_partition()
Nef-partition {0, 1, 3} U {2, 4, 5}
Nef-partition {0, 1, 3} {2, 4, 5}
sage: CI.nef_partition() is np
True
"""
Expand Down

0 comments on commit 45edf72

Please sign in to comment.