Function Integration#

Functions encoded in MPS/TT form can be efficiently integrated by contracting them with MPS encodings of weights that implement some quadrature formula. For instance, a simple Riemann approximation results from the addition of all values of the functions, weighted by the interval size, which are equivalent to the contraction between the representation of \(f(x)\) and the identity function \(g(x)=1\)

\[\int f(x)\mathrm{d}x \simeq \sum_i f(x_i) \Delta{x} = \langle g | f\rangle.\]

In this scenario, the quadrature corresponding to the state \(\langle g |\) is given by the midpoint quadrature rule. More sophisticated quadrature rules result in more efficient convergence rates—i.e. requiring less nodes or tensor cores to compute an accurate estimation of the true integral.

In the following table we outline implemented routines that construct the states associated to various quadratures—i.e. mps_* functions—and a routine that implements the integral using any of those rules integrate_mps(). These routines are valid for input MPS with binary physical dimension, following the quantics representation, and divide in two families:

Newton-Côtes quadratures#

These are useful to integrate equispaced discretizations, each of increasing order. Compatible with discretizations stemming from RegularInterval objects. The larger the order, the better the convergence rate. However, large-order quadratures impose restrictions on the amounts of qubits they support:

  • mps_simpson() requires a number of qubits divisible by 2.

  • mps_fifth_order() requires a number of qubits divisible by 4.

mps_trapezoidal(start, stop, sites)

Returns the binary MPS representation of the trapezoidal quadrature on an interval.

mps_simpson38(start, stop, sites)

Returns the binary MPS representation of the Simpson quadrature on an interval.

mps_fifth_order(start, stop, sites)

Returns the binary MPS representation of the fifth-order quadrature on an interval.

Clenshaw-Curtis quadratures#

These are useful to integrate irregular discretizations on either the Chebyshev zeros (Chebyshev-Gauss nodes) or the Chebyshev extrema (Chebyshev-Lobatto nodes). These have an exponentially better rate of convergence than the Newton-Côtes ones. Compatible with discretizations stemming from ChebyshevInterval objects.

mps_fejer(start, stop, sites[, ...])

Returns the binary MPS representation of the Fejér first quadrature rule on an interval.

mps_clenshaw_curtis(start, stop, sites[, ...])

Returns the binary MPS representation of the Clenshaw-Curtis quadrature rule on an interval.

Integration#

The standard method for integration consists in first constructing the multivariate quadrature rule using the previous routines, together with mps_tensor_product and mps_tensor_sum tensorized operations. Then, this quadrature is to be contracted with the desired MPS target using the scalar product routine scprod. However, for ease of use, a helper routine integrate_mps is given that automatically computes the best possible quadrature rule associated to a Mesh object, and contracts with the target MPS to compute the integral:

integrate_mps(mps, domain[, mps_order])

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

Both this helper routine and the MPS quadrature rules are only valid for standard function representations in MPS with binary quantization. For more general structures, integration using tensor cross-interpolation (TCI) is preferred, using the cross_interpolation() routine. Helper methods exist for the general case, requiring an input Mesh object containing the quadrature rules. The function quadrature_mesh_to_mps() transforms this mesh into a quadrature MPS which may be contracted with the input function using the inner product scprod().

mesh_to_quadrature_mesh(mesh)

Constructs a mesh whose entries are quadrature vectors derived from the best available quadrature rule for each Interval in the input mesh.

quadrature_mesh_to_mps(quadrature_mesh[, ...])

Constructs the MPS representation of a multidimensional quadrature mesh using TCI.

An example on how to use these functions is shown in Integration.ipynb.