seemps.analysis.chebyshev.cheb2mps#
- seemps.analysis.chebyshev.cheb2mps(coefficients, initial_mps=None, domain=None, strategy=<seemps.state.core.Strategy object>, clenshaw=True, rescale=True)[source]#
Composes a function on an initial MPS by expanding it on the basis of Chebyshev polynomials. Allows to load functions on MPS by providing a suitable initial MPS for a given interval. Takes as input the Chebyshev coefficients of a function f(x) defined in an interval [a, b] and, optionally, an initial MPS representing a function g(x) that is taken as the first order polynomial of the expansion. With this information, it constructs the MPS that approximates f(g(x)).
- Parameters:
- coefficients
np.polynomial.Chebyshev
The Chebyshev expansion coefficients representing the target function that is defined on a given interval [a, b].
- initial_mps
MPS
,optional
The initial MPS on which to apply the expansion. By default (if
rescale
isTrue
), it must have a support inside the domain of definition of the function [a, b]. Ifrescale
isFalse
, it must have a support inside [-1, 1].- domain
Interval
,optional
An alternative way to specify the initial MPS by constructing it from the given Interval.
- strategy
Strategy
, default=DEFAULT_STRATEGY The simplification strategy for operations between MPS.
- clenshawbool, default=True
Whether to use the Clenshaw algorithm for polynomial evaluation.
- rescalebool, default=True
Whether to perform an affine transformation of the initial MPS from the domain [a, b] of the Chebyshev coefficients to the canonical Chebyshev interval [-1, 1].
- coefficients
- Returns:
- f_mps
MPS
MPS representation of the polynomial expansion.
- f_mps
Notes
The computational complexity of the expansion depends on bond dimensions of the intermediate
states. For the case of loading univariate functions on RegularInterval domains, these are bounded by the polynomial order of each intermediate step. In general, these are determined by the function, the bond dimensions of the initial state and the simplification strategy used.
The Clenshaw evaluation method has a better performance overall, but performs worse when
the expansion order is overestimated. This can be avoided using the estimate_order method.
Examples
# Load an univariate Gaussian in an equispaced domain. start, stop = -1, 1 n_qubits = 10 func = lambda x: np.exp(-x**2) coefficients = interpolation_coefficients(func, start=start, stop=stop) domain = RegularInterval(start, stop, 2**n_qubits) mps = cheb2mps(coefficients, domain=domain)