ppl_utils
#
Some extra ppl utilities
ppl is a library to deal with rational polytopes. pplpy is a thin Python wrapper. This file provides some helper functions to use it.
- surface_dynamics.misc.ppl_utils.ppl_check_non_negative_cone(C)#
Check whether the input cone
C
is a subcone of the positive coneEXAMPLES:
sage: from surface_dynamics.misc.ppl_utils import ppl_check_non_negative_cone # optional: pplpy sage: import ppl # optional: pplpy sage: gs = ppl.Generator_System() # optional: pplpy sage: gs.insert(ppl.point()) # optional: pplpy sage: gs.insert(ppl.ray(ppl.Variable(0) + ppl.Variable(2))) # optional: pplpy sage: ppl_check_non_negative_cone(ppl.C_Polyhedron(gs)) # optional: pplpy sage: gs.insert(ppl.ray(-ppl.Variable(0) - ppl.Variable(2))) # optional: pplpy sage: ppl_check_non_negative_cone(ppl.C_Polyhedron(gs)) # optional: pplpy Traceback (most recent call last): ... ValueError: C must be a subcone of the non-negative cone sage: gs = ppl.Generator_System() # optional: pplpy sage: gs.insert(ppl.point(ppl.Variable(2))) # optional: pplpy sage: ppl_check_non_negative_cone(ppl.C_Polyhedron(gs)) # optional: pplpy Traceback (most recent call last): ... ValueError: the cone does not contain zero sage: gs.insert(ppl.point()) # optional: pplpy sage: ppl_check_non_negative_cone(ppl.C_Polyhedron(gs)) # optional: pplpy Traceback (most recent call last): ... ValueError: should have only zero as vertices
- surface_dynamics.misc.ppl_utils.ppl_cone(rays)#
Convert the list
rays
into a ppl coneEXAMPLES:
sage: from surface_dynamics.misc.ppl_utils import ppl_cone # optional: pplpy sage: C = ppl_cone([(0,1,2),(1,1,1),(1,0,1)]) # optional: pplpy sage: C.minimized_generators() # optional: pplpy Generator_System {point(0/1, 0/1, 0/1), ray(0, 1, 2), ray(1, 0, 1), ray(1, 1, 1)}
- surface_dynamics.misc.ppl_utils.ppl_convert(P)#
Convert a Sage polyhedron to a ppl polyhedron
EXAMPLES:
sage: from surface_dynamics.misc.ppl_utils import ppl_convert # optional: pplpy sage: P = ppl_convert(Polyhedron(vertices=[(0,1,0),(1,0,1)], rays=[(0,0,1),[3,2,1]])) # optional: pplpy sage: P.minimized_generators() # optional: pplpy Generator_System {ray(0, 0, 1), point(0/1, 1/1, 0/1), point(1/1, 0/1, 1/1), ray(3, 2, 1)}
- surface_dynamics.misc.ppl_utils.ppl_positive_cone(n)#
Return the positive cone in R^n
EXAMPLES:
sage: from surface_dynamics.misc.ppl_utils import ppl_positive_cone # optional: pplpy sage: C = ppl_positive_cone(3) # optional: pplpy sage: C.minimized_generators() # optional: pplpy Generator_System {point(0/1, 0/1, 0/1), ray(0, 0, 1), ray(0, 1, 0), ray(1, 0, 0)}
- surface_dynamics.misc.ppl_utils.ppl_zero_point(n)#
Return the origin in R^n
EXAMPLES:
sage: from surface_dynamics.misc.ppl_utils import ppl_zero_point # optional: pplpy sage: ppl_zero_point(3) # optional: pplpy point(0/1, 0/1, 0/1) sage: ppl_zero_point(5) # optional: pplpy point(0/1, 0/1, 0/1, 0/1, 0/1)