seemps.analysis.integration.integrate_mps#

seemps.analysis.integration.integrate_mps(mps: MPS, domain: TypeAliasForwardRef('~seemps.analysis.mesh.Interval') | TypeAliasForwardRef('~seemps.analysis.mesh.Mesh'), mps_order: Literal['A', 'B'] = 'A') complex[source]#

Compute the integral of a multivariate function represented as a MPS.

The function is integrated over the discretization domain specified by an Interval or a Mesh. The appropriate univariate quadrature rule is selected automatically from the interval type:

  • RegularInterval → high-order Newton–Cotes rules.

  • ChebyshevInterval → Clenshaw–Curtis or Fejér rules.

The integral is then evaluated by contracting the MPS with the tensor-product quadrature weights, respecting the qubit ordering specified by mps_order.

Parameters:
mpsMPS

MPS representation of the multivariate function to be integrated.

domainInterval | Mesh

The discretization domain of the function. A Mesh is interpreted as a list of univariate intervals, each contributing its own quadrature rule.

mps_orderMPSOrder, default=’A’

Ordering convention for the qubits: ‘A’ (serial) or ‘B’ (interleaved).

Returns:
complex

The value of the integral over the specified domain.

Notes

  • All variables are assumed to use base-2 quantization on either a RegularInterval or a ChebyshevInterval, in serial or interleaved form.

  • More general quadrature operators can be built manually by forming the tensor product of univariate rules and contracting with mps_tensor_product followed by scprod.

  • Quadrature meshes can also be constructed automatically using cross-interpolation using quadrature_mesh_to_mps() in arbitrary tensor arrangements.

Examples

Integrate a bivariate function using Clenshaw–Curtis quadrature:

mps_function_2d = ...  # MPS representation
interval = ChebyshevInterval(-1, 1, 2**10, endpoints=True)
mesh = Mesh([interval, interval])
integral = integrate_mps(mps_function_2d, mesh)