qpe_toolbox.estimation.robust_phase_estimation

Functions

robust_phase_estimation(H, psi0, epsilon, sign_E0, ...)

Perform the Robust Phase Estimation (RPE) algorithm.

rpe_get_hadamard_output(H, psi0, m, n_steps, n_shots, *)

Estimate the phase of \(\bra{\psi_0}\exp(-i H 2^m)\ket{\psi_0}\) using Hadamard tests.

rpe_distance(phi, theta)

Compute the angular distance between two angles.

rpe_update_theta(S, theta_ref)

Find the angle in a set closest to a reference angle.

Module Contents

qpe_toolbox.estimation.robust_phase_estimation.robust_phase_estimation(H, psi0, epsilon, sign_E0, n_steps, n_shots, *, trotter_order=2, verbosity=0)[source]

Perform the Robust Phase Estimation (RPE) algorithm.

This routine estimates the phase associated with the unitary time evolution generated by a Hamiltonian using a sequence of Hadamard tests at increasing evolution times.

The algorithm achieves a target precision epsilon by iteratively refining the phase estimate using powers of two evolution times.

Parameters:
  • H (Hamiltonian) – Hamiltonian object from the Hamiltonian class.

  • psi0 (MatrixProductState) – Initial quantum state \(\ket{\psi_0}\) of the system.

  • epsilon (float) – Target precision for the phase estimate.

  • sign_E0 (float) – Sign of the target energy eigenvalue.

  • n_steps (int or qpe_toolbox.EXACT) – Number of Trotter steps used to approximate the time evolution. Use EXACT for exact time evolution.

  • n_shots (int or EXACT) – Number of measurement shots used in the Hadamard test. Use EXACT to compute probabilities exactly.

  • trotter_order (int, default 2) – Order of the Trotter-Suzuki decomposition.

  • verbosity (int, default 0) – Verbosity level. If >= 1, print intermediate phase estimates.

Returns:

theta_list – List of phase estimates at each iteration. The last element corresponds to the most accurate estimate.

Return type:

list of float

qpe_toolbox.estimation.robust_phase_estimation.rpe_get_hadamard_output(H, psi0, m, n_steps, n_shots, *, trotter_order=2)[source]

Estimate the phase of \(\bra{\psi_0}\exp(-i H 2^m)\ket{\psi_0}\) using Hadamard tests.

This function computes the phase corresponding to the unitary evolution over time \(2^m\) by evaluating real and imaginary parts via Hadamard tests.

Parameters:
  • H (Hamiltonian) – Hamiltonian object defining the system.

  • psi0 (MatrixProductState) – Initial quantum state \(\ket{\psi_0}\).

  • m (int) – Iteration index corresponding to evolution time 2**m.

  • n_steps (int or qpe_toolbox.EXACT) – Number of Trotter steps. Use EXACT for exact time evolution.

  • n_shots (int or qpe_toolbox.EXACT) – Number of measurement shots used in the Hadamard test. Use EXACT to compute probabilities exactly.

  • trotter_order (int, default 2) – Order of the Trotter-Suzuki decomposition.

Returns:

phi_m – Estimated phase angle in radians.

Return type:

float

qpe_toolbox.estimation.robust_phase_estimation.rpe_distance(phi, theta)[source]

Compute the angular distance between two angles.

The distance is defined modulo π and lies in the interval [0, π].

Parameters:
  • phi (float) – First angle in radians.

  • theta (float) – Second angle in radians.

Returns:

d – Angular distance between phi and theta.

Return type:

float

qpe_toolbox.estimation.robust_phase_estimation.rpe_update_theta(S, theta_ref)[source]

Find the angle in a set closest to a reference angle.

The comparison is performed using the angular distance modulo 2π.

Parameters:
  • S (list of float) – Candidate angles.

  • theta_ref (float) – Reference angle.

Returns:

  • theta_min (float) – Angle in S closest to theta_ref.

  • d_min (float) – Corresponding minimal angular distance.