From a7c2021c2e11c9af96464ad51dd52b9c6959eb55 Mon Sep 17 00:00:00 2001 From: positr0nium Date: Thu, 21 Nov 2024 17:09:45 +0100 Subject: [PATCH] reduced QPE precision in the other hamsim test --- tests/operator_tests/test_qubit_hamiltonian_simulation.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/operator_tests/test_qubit_hamiltonian_simulation.py b/tests/operator_tests/test_qubit_hamiltonian_simulation.py index e4371d9c..8fcd0627 100644 --- a/tests/operator_tests/test_qubit_hamiltonian_simulation.py +++ b/tests/operator_tests/test_qubit_hamiltonian_simulation.py @@ -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