Access the PALP database(s) of reflexive lattice polytopes#

EXAMPLES:

sage: from sage.geometry.polyhedron.palp_database import PALPreader
sage: for lp in PALPreader(2):                                                      # needs sage.graphs
....:     cone = Cone([(1,r[0],r[1]) for r in lp.vertices()])
....:     fan = Fan([cone])
....:     X = ToricVariety(fan)
....:     ideal = X.affine_algebraic_patch(cone).defining_ideal()
....:     print("{} {}".format(lp.n_vertices(), ideal.hilbert_series()))
3 (t^2 + 7*t + 1)/(-t^3 + 3*t^2 - 3*t + 1)
3 (t^2 + t + 1)/(-t^3 + 3*t^2 - 3*t + 1)
3 (t^2 + 6*t + 1)/(-t^3 + 3*t^2 - 3*t + 1)
3 (t^2 + 2*t + 1)/(-t^3 + 3*t^2 - 3*t + 1)
3 (t^2 + 4*t + 1)/(-t^3 + 3*t^2 - 3*t + 1)
4 (t^2 + 5*t + 1)/(-t^3 + 3*t^2 - 3*t + 1)
4 (t^2 + 3*t + 1)/(-t^3 + 3*t^2 - 3*t + 1)
4 (t^2 + 2*t + 1)/(-t^3 + 3*t^2 - 3*t + 1)
4 (t^2 + 6*t + 1)/(-t^3 + 3*t^2 - 3*t + 1)
4 (t^2 + 6*t + 1)/(-t^3 + 3*t^2 - 3*t + 1)
4 (t^2 + 2*t + 1)/(-t^3 + 3*t^2 - 3*t + 1)
4 (t^2 + 4*t + 1)/(-t^3 + 3*t^2 - 3*t + 1)
5 (t^2 + 3*t + 1)/(-t^3 + 3*t^2 - 3*t + 1)
5 (t^2 + 5*t + 1)/(-t^3 + 3*t^2 - 3*t + 1)
5 (t^2 + 4*t + 1)/(-t^3 + 3*t^2 - 3*t + 1)
6 (t^2 + 4*t + 1)/(-t^3 + 3*t^2 - 3*t + 1)
>>> from sage.all import *
>>> from sage.geometry.polyhedron.palp_database import PALPreader
>>> for lp in PALPreader(Integer(2)):                                                      # needs sage.graphs
...     cone = Cone([(Integer(1),r[Integer(0)],r[Integer(1)]) for r in lp.vertices()])
...     fan = Fan([cone])
...     X = ToricVariety(fan)
...     ideal = X.affine_algebraic_patch(cone).defining_ideal()
...     print("{} {}".format(lp.n_vertices(), ideal.hilbert_series()))
3 (t^2 + 7*t + 1)/(-t^3 + 3*t^2 - 3*t + 1)
3 (t^2 + t + 1)/(-t^3 + 3*t^2 - 3*t + 1)
3 (t^2 + 6*t + 1)/(-t^3 + 3*t^2 - 3*t + 1)
3 (t^2 + 2*t + 1)/(-t^3 + 3*t^2 - 3*t + 1)
3 (t^2 + 4*t + 1)/(-t^3 + 3*t^2 - 3*t + 1)
4 (t^2 + 5*t + 1)/(-t^3 + 3*t^2 - 3*t + 1)
4 (t^2 + 3*t + 1)/(-t^3 + 3*t^2 - 3*t + 1)
4 (t^2 + 2*t + 1)/(-t^3 + 3*t^2 - 3*t + 1)
4 (t^2 + 6*t + 1)/(-t^3 + 3*t^2 - 3*t + 1)
4 (t^2 + 6*t + 1)/(-t^3 + 3*t^2 - 3*t + 1)
4 (t^2 + 2*t + 1)/(-t^3 + 3*t^2 - 3*t + 1)
4 (t^2 + 4*t + 1)/(-t^3 + 3*t^2 - 3*t + 1)
5 (t^2 + 3*t + 1)/(-t^3 + 3*t^2 - 3*t + 1)
5 (t^2 + 5*t + 1)/(-t^3 + 3*t^2 - 3*t + 1)
5 (t^2 + 4*t + 1)/(-t^3 + 3*t^2 - 3*t + 1)
6 (t^2 + 4*t + 1)/(-t^3 + 3*t^2 - 3*t + 1)
class sage.geometry.polyhedron.palp_database.PALPreader(dim, data_basename=None, output='Polyhedron')[source]#

Bases: SageObject

Read PALP database of polytopes.

INPUT:

  • dim – integer. The dimension of the polyhedra

  • data_basename – string or None (default). The directory and database base filename (PALP usually uses 'zzdb') name containing the PALP database to read. Defaults to the built-in database location.

  • output – string. How to return the reflexive polyhedron data. Allowed values = 'list', 'Polyhedron' (default), 'pointcollection', and 'PPL'. Case is ignored.

EXAMPLES:

sage: from sage.geometry.polyhedron.palp_database import PALPreader
sage: polygons = PALPreader(2)
sage: [ (p.n_Vrepresentation(), len(p.integral_points())) for p in polygons ]
[(3, 4), (3, 10), (3, 5), (3, 9), (3, 7), (4, 6), (4, 8), (4, 9),
 (4, 5), (4, 5), (4, 9), (4, 7), (5, 8), (5, 6), (5, 7), (6, 7)]

sage: next(iter(PALPreader(2, output='list')))
[[1, 0], [0, 1], [-1, -1]]
sage: type(_)
<... 'list'>

sage: next(iter(PALPreader(2, output='Polyhedron')))
A 2-dimensional polyhedron in ZZ^2 defined as the convex hull of 3 vertices
sage: type(_)
<class 'sage.geometry.polyhedron.parent.Polyhedra_ZZ_ppl_with_category.element_class'>

sage: next(iter(PALPreader(2, output='PPL')))
A 2-dimensional lattice polytope in ZZ^2 with 3 vertices
sage: type(_)
<class 'sage.geometry.polyhedron.ppl_lattice_polygon.LatticePolygon_PPL_class'>

sage: next(iter(PALPreader(2, output='PointCollection')))
[ 1,  0],
[ 0,  1],
[-1, -1]
in Ambient free module of rank 2 over the principal ideal domain Integer Ring
sage: type(_)
<class 'sage.geometry.point_collection.PointCollection'>
>>> from sage.all import *
>>> from sage.geometry.polyhedron.palp_database import PALPreader
>>> polygons = PALPreader(Integer(2))
>>> [ (p.n_Vrepresentation(), len(p.integral_points())) for p in polygons ]
[(3, 4), (3, 10), (3, 5), (3, 9), (3, 7), (4, 6), (4, 8), (4, 9),
 (4, 5), (4, 5), (4, 9), (4, 7), (5, 8), (5, 6), (5, 7), (6, 7)]

>>> next(iter(PALPreader(Integer(2), output='list')))
[[1, 0], [0, 1], [-1, -1]]
>>> type(_)
<... 'list'>

>>> next(iter(PALPreader(Integer(2), output='Polyhedron')))
A 2-dimensional polyhedron in ZZ^2 defined as the convex hull of 3 vertices
>>> type(_)
<class 'sage.geometry.polyhedron.parent.Polyhedra_ZZ_ppl_with_category.element_class'>

>>> next(iter(PALPreader(Integer(2), output='PPL')))
A 2-dimensional lattice polytope in ZZ^2 with 3 vertices
>>> type(_)
<class 'sage.geometry.polyhedron.ppl_lattice_polygon.LatticePolygon_PPL_class'>

>>> next(iter(PALPreader(Integer(2), output='PointCollection')))
[ 1,  0],
[ 0,  1],
[-1, -1]
in Ambient free module of rank 2 over the principal ideal domain Integer Ring
>>> type(_)
<class 'sage.geometry.point_collection.PointCollection'>
class sage.geometry.polyhedron.palp_database.Reflexive4dHodge(h11, h21, data_basename=None, **kwds)[source]#

Bases: PALPreader

Read the PALP database for Hodge numbers of 4d polytopes.

The database is very large and not installed by default. You can install it with the shell command sage -i polytopes_db_4d.

INPUT:

  • h11, h21 – Integers. The Hodge numbers of the reflexive polytopes to list.

Any additional keyword arguments are passed to PALPreader.

EXAMPLES:

sage: from sage.geometry.polyhedron.palp_database import Reflexive4dHodge
sage: ref = Reflexive4dHodge(1,101)             # optional - polytopes_db_4d
sage: next(iter(ref)).Vrepresentation()         # optional - polytopes_db_4d
(A vertex at (-1, -1, -1, -1), A vertex at (0, 0, 0, 1),
 A vertex at (0, 0, 1, 0), A vertex at (0, 1, 0, 0), A vertex at (1, 0, 0, 0))
>>> from sage.all import *
>>> from sage.geometry.polyhedron.palp_database import Reflexive4dHodge
>>> ref = Reflexive4dHodge(Integer(1),Integer(101))             # optional - polytopes_db_4d
>>> next(iter(ref)).Vrepresentation()         # optional - polytopes_db_4d
(A vertex at (-1, -1, -1, -1), A vertex at (0, 0, 0, 1),
 A vertex at (0, 0, 1, 0), A vertex at (0, 1, 0, 0), A vertex at (1, 0, 0, 0))