The PPL (Parma Polyhedra Library) backend for polyhedral computations#

class sage.geometry.polyhedron.backend_ppl.Polyhedron_QQ_ppl(parent, Vrep, Hrep, ppl_polyhedron=None, mutable=False, **kwds)[source]#

Polyhedra over $$\QQ$$ with ppl

INPUT:

• Vrep – a list [vertices, rays, lines] or None.

• Hrep – a list [ieqs, eqns] or None.

EXAMPLES:

sage: p = Polyhedron(vertices=[(0,0),(1,0),(0,1)], rays=[(1,1)], lines=[],
....:                backend='ppl', base_ring=QQ)
sage: TestSuite(p).run()

>>> from sage.all import *
>>> p = Polyhedron(vertices=[(Integer(0),Integer(0)),(Integer(1),Integer(0)),(Integer(0),Integer(1))], rays=[(Integer(1),Integer(1))], lines=[],
...                backend='ppl', base_ring=QQ)
>>> TestSuite(p).run()

class sage.geometry.polyhedron.backend_ppl.Polyhedron_ZZ_ppl(parent, Vrep, Hrep, ppl_polyhedron=None, mutable=False, **kwds)[source]#

Polyhedra over $$\ZZ$$ with ppl

INPUT:

• Vrep – a list [vertices, rays, lines] or None.

• Hrep – a list [ieqs, eqns] or None.

EXAMPLES:

sage: p = Polyhedron(vertices=[(0,0),(1,0),(0,1)], rays=[(1,1)], lines=[],
....:                backend='ppl', base_ring=ZZ)
sage: TestSuite(p).run()

>>> from sage.all import *
>>> p = Polyhedron(vertices=[(Integer(0),Integer(0)),(Integer(1),Integer(0)),(Integer(0),Integer(1))], rays=[(Integer(1),Integer(1))], lines=[],
...                backend='ppl', base_ring=ZZ)
>>> TestSuite(p).run()

class sage.geometry.polyhedron.backend_ppl.Polyhedron_ppl(parent, Vrep, Hrep, ppl_polyhedron=None, mutable=False, **kwds)[source]#

Bases: Polyhedron_mutable

Polyhedra with ppl

INPUT:

• Vrep – a list [vertices, rays, lines] or None.

• Hrep – a list [ieqs, eqns] or None.

EXAMPLES:

sage: p = Polyhedron(vertices=[(0,0),(1,0),(0,1)], rays=[(1,1)], lines=[], backend='ppl')
sage: TestSuite(p).run()

>>> from sage.all import *
>>> p = Polyhedron(vertices=[(Integer(0),Integer(0)),(Integer(1),Integer(0)),(Integer(0),Integer(1))], rays=[(Integer(1),Integer(1))], lines=[], backend='ppl')
>>> TestSuite(p).run()

Hrepresentation(index=None)[source]#

Return the objects of the H-representation. Each entry is either an inequality or a equation.

INPUT:

• index – either an integer or None

OUTPUT:

The optional argument is an index running from 0 to self.n_Hrepresentation()-1. If present, the H-representation object at the given index will be returned. Without an argument, returns the list of all H-representation objects.

EXAMPLES:

sage: p = polytopes.hypercube(3)
sage: p.Hrepresentation(0)
An inequality (-1, 0, 0) x + 1 >= 0
sage: p.Hrepresentation(0) == p.Hrepresentation()[0]
True

>>> from sage.all import *
>>> p = polytopes.hypercube(Integer(3))
>>> p.Hrepresentation(Integer(0))
An inequality (-1, 0, 0) x + 1 >= 0
>>> p.Hrepresentation(Integer(0)) == p.Hrepresentation()[Integer(0)]
True

sage: P = p.parent()
sage: p = P._element_constructor_(p, mutable=True)
sage: p.Hrepresentation(0)
An inequality (0, 0, -1) x + 1 >= 0
sage: p._clear_cache()
sage: p.Hrepresentation(0)
An inequality (0, 0, -1) x + 1 >= 0
sage: TestSuite(p).run()

>>> from sage.all import *
>>> P = p.parent()
>>> p = P._element_constructor_(p, mutable=True)
>>> p.Hrepresentation(Integer(0))
An inequality (0, 0, -1) x + 1 >= 0
>>> p._clear_cache()
>>> p.Hrepresentation(Integer(0))
An inequality (0, 0, -1) x + 1 >= 0
>>> TestSuite(p).run()

Vrepresentation(index=None)[source]#

Return the objects of the V-representation. Each entry is either a vertex, a ray, or a line.

See sage.geometry.polyhedron.constructor for a definition of vertex/ray/line.

INPUT:

• index – either an integer or None

OUTPUT:

The optional argument is an index running from 0 to self.n_Vrepresentation()-1. If present, the V-representation object at the given index will be returned. Without an argument, returns the list of all V-representation objects.

EXAMPLES:

sage: p = polytopes.cube()
sage: p.Vrepresentation(0)
A vertex at (1, -1, -1)

>>> from sage.all import *
>>> p = polytopes.cube()
>>> p.Vrepresentation(Integer(0))
A vertex at (1, -1, -1)

sage: P = p.parent()
sage: p = P._element_constructor_(p, mutable=True)
sage: p.Vrepresentation(0)
A vertex at (-1, -1, -1)
sage: p._clear_cache()
sage: p.Vrepresentation(0)
A vertex at (-1, -1, -1)
sage: TestSuite(p).run()

>>> from sage.all import *
>>> P = p.parent()
>>> p = P._element_constructor_(p, mutable=True)
>>> p.Vrepresentation(Integer(0))
A vertex at (-1, -1, -1)
>>> p._clear_cache()
>>> p.Vrepresentation(Integer(0))
A vertex at (-1, -1, -1)
>>> TestSuite(p).run()

set_immutable()[source]#

Make this polyhedron immutable. This operation cannot be undone.

EXAMPLES:

sage: p = Polyhedron([[1, 1]], mutable=True)
sage: p.is_mutable()
True
sage: hasattr(p, "_Vrepresentation")
False
sage: p.set_immutable()
sage: hasattr(p, "_Vrepresentation")
True

>>> from sage.all import *
>>> p = Polyhedron([[Integer(1), Integer(1)]], mutable=True)
>>> p.is_mutable()
True
>>> hasattr(p, "_Vrepresentation")
False
>>> p.set_immutable()
>>> hasattr(p, "_Vrepresentation")
True