Interface to LattE integrale programs¶
- sage.interfaces.latte.count(arg, ehrhart_polynomial=False, multivariate_generating_function=False, raw_output=False, verbose=False, **kwds)¶
Call to the program count from LattE integrale
INPUT:
arg– a cdd or LattE description stringehrhart_polynomial,multivariate_generating_function– to compute Ehrhart polynomial or multivariate generating function instead of just counting pointsraw_output– ifTruethen return directly the output string from LattEFor all other options of the count program, consult the LattE manual
OUTPUT:
Either a string (if
raw_outputif set toTrue) or an integer (when counting points), or a polynomial (ifehrhart_polynomialis set toTrue) or a multivariate THING (ifmultivariate_generating_functionis set toTrue)EXAMPLES:
sage: from sage.interfaces.latte import count # optional - latte_int sage: P = 2 * polytopes.cube()
Counting integer points from either the H or V representation:
sage: count(P.cdd_Hrepresentation(), cdd=True) # optional - latte_int 125 sage: count(P.cdd_Vrepresentation(), cdd=True) # optional - latte_int 125
Ehrhart polynomial:
sage: count(P.cdd_Hrepresentation(), cdd=True, ehrhart_polynomial=True) # optional - latte_int 64*t^3 + 48*t^2 + 12*t + 1
Multivariate generating function currently only work with
raw_output=True:sage: opts = {'cdd': True, ....: 'multivariate_generating_function': True, ....: 'raw_output': True} sage: cddin = P.cdd_Hrepresentation() sage: print(count(cddin, **opts)) # optional - latte_int x[0]^2*x[1]^(-2)*x[2]^(-2)/((1-x[1])*(1-x[2])*(1-x[0]^(-1))) + x[0]^(-2)*x[1]^(-2)*x[2]^(-2)/((1-x[1])*(1-x[2])*(1-x[0])) + x[0]^2*x[1]^(-2)*x[2]^2/((1-x[1])*(1-x[2]^(-1))*(1-x[0]^(-1))) + x[0]^(-2)*x[1]^(-2)*x[2]^2/((1-x[1])*(1-x[0])*(1-x[2]^(-1))) + x[0]^2*x[1]^2*x[2]^(-2)/((1-x[2])*(1-x[1]^(-1))*(1-x[0]^(-1))) + x[0]^(-2)*x[1]^2*x[2]^(-2)/((1-x[2])*(1-x[0])*(1-x[1]^(-1))) + x[0]^2*x[1]^2*x[2]^2/((1-x[2]^(-1))*(1-x[1]^(-1))*(1-x[0]^(-1))) + x[0]^(-2)*x[1]^2*x[2]^2/((1-x[0])*(1-x[2]^(-1))*(1-x[1]^(-1)))
- sage.interfaces.latte.integrate(arg, polynomial=None, algorithm='triangulate', raw_output=False, verbose=False, **kwds)¶
Call to the function integrate from LattE integrale.
INPUT:
arg– a cdd or LattE description string.polynomial– multivariate polynomial or valid LattE polynomial description string. If given, the valuation parameter of LattE is set to integrate, and is set to volume otherwise.algorithm– (default: ‘triangulate’) the integration method. Use ‘triangulate’ for polytope triangulation or ‘cone-decompose’ for tangent cone decomposition method.raw_output– ifTruethen return directly the output string from LattE.verbose– ifTruethen return directly verbose output from LattE.For all other options of the integrate program, consult the LattE manual.
OUTPUT:
Either a string (if
raw_outputif set toTrue) or a rational.EXAMPLES:
sage: from sage.interfaces.latte import integrate # optional - latte_int sage: P = 2 * polytopes.cube() sage: x, y, z = polygen(QQ, 'x, y, z')
Integrating over a polynomial over a polytope in either the H or V representation:
sage: integrate(P.cdd_Hrepresentation(), x^2*y^2*z^2, cdd=True) # optional - latte_int 4096/27 sage: integrate(P.cdd_Vrepresentation(), x^2*y^2*z^2, cdd=True) # optional - latte_int 4096/27
Computing the volume of a polytope in either the H or V representation:
sage: integrate(P.cdd_Hrepresentation(), cdd=True) # optional - latte_int 64 sage: integrate(P.cdd_Vrepresentation(), cdd=True) # optional - latte_int 64
Polynomials given as a string in LattE description are also accepted:
sage: integrate(P.cdd_Hrepresentation(), '[[1,[2,2,2]]]', cdd=True) # optional - latte_int 4096/27
- sage.interfaces.latte.to_latte_polynomial(polynomial)¶
Helper function to transform a polynomial to its LattE description.
INPUT:
polynomial– a multivariate polynomial.
OUTPUT:
A string that describes the monomials list and exponent vectors.