wmpy.integration.parallel.ParallelWrapper

class ParallelWrapper(integrator, n_processes=8)[source]

Bases: object

This class implements a multiprocessing integration wrapper.

Default constructor.

integrator

the enclosed integrator instance

n_processes

maximum number of spawnable subprocesses

Methods

integrate

Computes a convex integral.

integrate_batch

Computes a batch of integrals.

Attributes

DEF_N_PROCESSES

integrate(polytope, polynomial)[source]

Computes a convex integral.

In principle, this should not be called.

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.