wmpy.integration.latte.LattEIntegrator

class LattEIntegrator(algorithm='--cone-decompose')[source]

Bases: object

This class is a wrapper for the LattE integrator. It computes the exact integral of a polynomial over a convex polytope.

Default constructor.

Parameters:

algorithm (str) – either “–triangulate” or “–cone-decompose”

Raises:

ValueError if algorithm is not supported."

Methods

integrate

Computes a convex integral.

integrate_batch

Computes a batch of integrals.

Attributes

ALGORITHMS

ALG_CONE_DECOMPOSE

ALG_TRIANGULATE

DEF_ALGORITHM

integrate(polytope, polynomial)[source]

Computes a convex integral.

Parameters:
  • polytope (Polytope) – convex integration bounds (a Polytope)

  • polynomial (Polynomial) – integrand (a Polynomial)

Return type:

float

Returns:

The result of the integration as a non-negative scalar value.

integrate_batch(convex_integrals)[source]

Computes a batch of integrals.

Parameters:

convex_integrals (Collection[tuple[Polytope, Polynomial]]) – a collection of bounds/integrand pairs

Return type:

ndarray

Returns:

The result of the batch of integrations as a numpy array.