fiqci.ems.mitigators.zne#

Extrapolation methods for Zero-Noise Extrapolation.

Functions

exponential_extrapolation(...[, eps, sigmas])

Perform exponential extrapolation to estimate the zero-noise value.

polynomial_extrapolation(expectation_values, ...)

Polynomial least-squares extrapolation to estimate the zero-noise value.

richardson_extrapolation(expectation_values, ...)

Richardson extrapolation to estimate the zero-noise value.

exponential_extrapolation(expectation_values: list[list[float]], scale_factors: list[float], eps: float = 1e-09, sigmas: list[list[float]] | None = None) list[float] | tuple[list[float], list[float]]#

Perform exponential extrapolation to estimate the zero-noise value.

Fits y = sign * exp(b) * exp(a * x) in log-space per observable. Magnitudes are floored relative to each column’s largest value before taking the log, so values that are ~0 (or whose sign flips due to noise) can’t produce log(0) = -inf or dominate the linear fit.

Parameters:
  • expectation_values – Expectation values of shape (n_scales, n_obs) or (n_scales,).

  • scale_factors – Noise scale factors corresponding to different noise levels.

  • eps – Magnitude floor as a fraction of each column’s maximum magnitude.

  • sigmas – Optional per-scale shot standard errors, same shape as expectation_values. When provided, the per-observable standard error of the extrapolated value is returned alongside the values.

Returns:

The extrapolated zero-noise expectation value(s), or (values, standard_errors) when sigmas is provided.

richardson_extrapolation(expectation_values: list[list[float]], scales: list[float], sigmas: list[list[float]] | None = None) list[float] | tuple[list[float], list[float]]#

Richardson extrapolation to estimate the zero-noise value.

Computes exact Lagrange interpolation coefficients evaluated at x=0: cᵢ = ∏_{j≠i} λⱼ / (λⱼ - λᵢ) and returns E(0) = Σᵢ cᵢ · E(λᵢ).

Parameters:
  • expectation_values – Array-like of shape (n_scales, n_obs) or (n_scales,)

  • scales – Noise scale factors used (e.g., [1, 3, 5])

  • sigmas – Optional per-scale shot standard errors, same shape as expectation_values. When provided, the per-observable standard error of the extrapolated value is returned alongside the values.

Returns:

Zero-noise estimate(s) per observable, or (values, standard_errors) when sigmas is provided.

polynomial_extrapolation(expectation_values: list[list[float]], scales: list[float], degree: int | None = None, sigmas: list[list[float]] | None = None) list[float] | tuple[list[float], list[float]]#

Polynomial least-squares extrapolation to estimate the zero-noise value.

Fits a polynomial of the given degree to the (scale, expectation_value) data and evaluates it at x=0.

Parameters:
  • expectation_values – Array-like of shape (n_scales, n_obs) or (n_scales,)

  • scales – Noise scale factors used (e.g., [1, 3, 5])

  • degree – Polynomial degree. Defaults to min(n_scales - 1, 2).

  • sigmas – Optional per-scale shot standard errors, same shape as expectation_values. When provided, the per-observable standard error of the extrapolated value is returned alongside the values.

Returns:

Zero-noise estimate(s) per observable, or (values, standard_errors) when sigmas is provided.