Skip to content

Commit

Permalink
reduced QPE precision in the other hamsim test
Browse files Browse the repository at this point in the history
  • Loading branch information
positr0nium committed Nov 21, 2024
1 parent f094f6f commit a7c2021
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tests/operator_tests/test_qubit_hamiltonian_simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@ def test_qubit_hamiltonian_simulation():
E1 = H.get_measurement(qv)
assert abs(E1-E0)<5e-2

qpe_res = QPE(qv,U,precision=10,kwargs={"steps":3},iter_spec=True)
qpe_res = QPE(qv,U,precision=6,kwargs={"steps":3},iter_spec=True)

results = qpe_res.get_measurement()
sorted_results= dict(sorted(results.items(), key=lambda item: item[1], reverse=True))

phi = list(sorted_results.items())[0][0]
E_qpe = 2*np.pi*(phi-1) # Results are modulo 2*pi, therefore subtract 2*pi
assert abs(E_qpe-E0)<5e-3
assert abs(E_qpe-E0)<2e-2


from scipy.linalg import expm, norm
Expand Down

0 comments on commit a7c2021

Please sign in to comment.