qpe_toolbox.estimation.robust_phase_estimation¶
Functions¶
|
Perform the Robust Phase Estimation (RPE) algorithm. |
|
Estimate the phase of \(\bra{\psi_0}\exp(-i H 2^m)\ket{\psi_0}\) using Hadamard tests. |
|
Compute the angular distance between two angles. |
|
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
epsilonby iteratively refining the phase estimate using powers of two evolution times.- Parameters:
H (Hamiltonian) – Hamiltonian object from the
Hamiltonianclass.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
EXACTfor exact time evolution.n_shots (int or EXACT) – Number of measurement shots used in the Hadamard test. Use
EXACTto 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:
- 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
EXACTfor exact time evolution.n_shots (int or qpe_toolbox.EXACT) – Number of measurement shots used in the Hadamard test. Use
EXACTto compute probabilities exactly.trotter_order (int, default
2) – Order of the Trotter-Suzuki decomposition.
- Returns:
phi_m – Estimated phase angle in radians.
- Return type:
- 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, π].