paddle_quantum.qpp.laurent
- class paddle_quantum.qpp.laurent.Laurent(coef)
Bases:
object
Class for Laurent polynomial defined as \(P:\mathbb{C}[X, X^{-1}] \to \mathbb{C} :x \mapsto \sum_{j = -L}^{L} p_j X^j\).
- Parameters:
coef (ndarray) – list of coefficients of Laurent poly, arranged as \(\{p_{-L}, ..., p_{-1}, p_0, p_1, ..., p_L\}\).
- property coef: ndarray
The coefficients of this polynomial in ascending order (of indices).
- property conj: Laurent
The conjugate of this polynomial i.e. \(P(x) = \sum_{j = -L}^{L} p_{-j}^* X^j\).
- property roots: List[complex]
List of roots of this polynomial.
- property norm: float
The square sum of absolute value of coefficients of this polynomial.
- property max_norm: float
The maximum of absolute value of coefficients of this polynomial.
- property parity: int
Parity of this polynomial.
- is_parity(p)
Whether this Laurent polynomial has parity \(p % 2\).
- Parameters:
p (int) – parity.
- Returns:
whether parity is p % 2;
if not, then return the the (maximum) absolute coef term breaking such parity;
if not, then return the the (minimum) absolute coef term obeying such parity.
- Return type:
contains the following elements
- reduced_poly(target_deg)
Generate \(P'(x) = \sum_{j = -D}^{D} p_j X^j\), where \(D \leq L\) is target_deg.
- Parameters:
target_deg (int) – the degree of returned polynomial
- paddle_quantum.qpp.laurent.revise_tol(t)
Revise the value of TOL.
- paddle_quantum.qpp.laurent.remove_abs_error(data, tol=None)
Remove the error in data array.
- Parameters:
data (ndarray) – data array.
tol (float | None) – error tolerance.
- Returns:
sanitized data.
- Return type:
ndarray
- paddle_quantum.qpp.laurent.random_laurent_poly(deg, parity=None, is_real=False)
Randomly generate a Laurent polynomial.
- Parameters:
deg (int) – degree of this poly.
parity (int | None) – parity of this poly, defaults to be None.
is_real (bool | None) – whether coefficients of this poly are real, defaults to be False.
- Returns:
a Laurent poly with norm less than or equal to 1.
- Return type:
- paddle_quantum.qpp.laurent.sqrt_generation(A)
Generate the “square root” of a Laurent polynomial \(A\).
- Parameters:
A (Laurent) – a Laurent polynomial.
- Returns:
a Laurent polynomial \(Q\) such that \(QQ^* = A\).
- Return type:
Note
More details are in Lemma S1 of the paper https://arxiv.org/abs/2209.14278.
- paddle_quantum.qpp.laurent.Q_generation(P)
Generate a Laurent complement for Laurent polynomial \(P\).
- paddle_quantum.qpp.laurent.pair_generation(f)
Generate Laurent pairs for Laurent polynomial \(f\).
- paddle_quantum.qpp.laurent.laurent_generator(fn, dx, deg, L)
Generate a Laurent polynomial (with \(X = e^{ix / 2}\)) approximating fn.
- Parameters:
fn (Callable[[ndarray], ndarray]) – function to be approximated.
dx (float) – sampling frequency of data points.
deg (int) – degree of Laurent poly.
L (float) – half of approximation width.
- Returns:
a Laurent polynomial approximating fn in interval \([-L, L]\) with degree deg.
- Return type:
- paddle_quantum.qpp.laurent.hamiltonian_laurent(t, deg)
Generate a Laurent polynomial approximating the Hamiltonian evolution function.
- Parameters:
t (float) – evolution constant (time).
deg (int) – (even) degree of the output Laurent poly.
- Returns:
a Laurent poly approximating \(e^{it \cos(x)}\).
- Return type:
Note
originated from the Jacobi-Anger expansion: \(y(x) = \sum_n i^n Bessel(n, x) e^{inx}\);
used in Hamiltonian simulation.
- paddle_quantum.qpp.laurent.ln_laurent(deg, t)
Generate a Laurent polynomial approximating the ln function.
- Parameters:
deg (int) – degree of Laurent polynomial that is a factor of 4.
t (float) – normalization factor.
- Returns:
a Laurent poly approximating \(ln(cos(x)^2) / t\).
- Return type:
Note
used in von Neumann entropy estimation.
- paddle_quantum.qpp.laurent.power_laurent(deg, alpha, t)
Generate a Laurent polynomial approximating the power function.
- Parameters:
deg (int) – degree of Laurent polynomial that is a factor of 4.
alpha (float) – the # of power.
t (float) – normalization factor.
- Returns:
a Laurent poly approximating \((cos(x)^2)^{\alpha / 2} / t\).
- Return type: