paddle_quantum.qpp.laurent
- class paddle_quantum.qpp.laurent.Laurent(coef)
Bases:
object
Class for Laurent polynomial defined as
.- Parameters:
coef (ndarray) – list of coefficients of Laurent poly, arranged as
.
- property coef: ndarray
The coefficients of this polynomial in ascending order (of indices).
- 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
.- 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
, where 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
.- Parameters:
A (Laurent) – a Laurent polynomial.
- Returns:
a Laurent polynomial
such that .- 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
.
- paddle_quantum.qpp.laurent.pair_generation(f)
Generate Laurent pairs for Laurent polynomial
.
- paddle_quantum.qpp.laurent.laurent_generator(fn, dx, deg, L)
Generate a Laurent polynomial (with
) 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
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
.- Return type:
Note
originated from the Jacobi-Anger expansion:
;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
.- 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
.- Return type: