Skip to content

Commit

Permalink
atol instead of rtol
Browse files Browse the repository at this point in the history
  • Loading branch information
thangleiter committed Jun 19, 2020
1 parent 85ded21 commit 9a88506
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions tests/test_precision.py
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,7 @@ def test_multi_qubit_error_transfer_matrix(self):
omega = util.get_sample_frequencies(pulse, n_samples=51)

# Assert fidelity is same as computed by infidelity()
S = 1e-9/omega**2
S = 1e-8/omega**2
U = ff.error_transfer_matrix(pulse, S, omega)
# Calculate U in loop
Up = ff.error_transfer_matrix(pulse, S, omega,
Expand All @@ -586,9 +586,9 @@ def test_multi_qubit_error_transfer_matrix(self):
I_transfer = 1 - np.einsum('...ii', U)/d**2
self.assertArrayAlmostEqual(Up, U)
self.assertArrayAlmostEqual(I_transfer, I_fidelity.sum(),
rtol=1e-3)
atol=1e-4)

S = np.outer(1e-8*(np.arange(n_nops) + 1),
S = np.outer(1e-7*(np.arange(n_nops) + 1),
400/(omega**2 + 400))
U = ff.error_transfer_matrix(pulse, S, omega)
# Calculate U in loop
Expand All @@ -598,10 +598,10 @@ def test_multi_qubit_error_transfer_matrix(self):
I_transfer = 1 - np.einsum('...ii', U)/d**2
self.assertArrayAlmostEqual(Up, U)
self.assertArrayAlmostEqual(I_transfer, I_fidelity.sum(),
rtol=1e-3)
atol=1e-4)

S = np.tile(1e-9/abs(omega)**2, (n_nops, n_nops, 1)).astype(
complex)
S = np.tile(1e-8/abs(omega)**2, (n_nops, n_nops, 1)).astype(
complex)
S[np.triu_indices(n_nops, 1)].imag = 1e-10*omega
S[np.tril_indices(n_nops, -1)].imag = \
- S[np.triu_indices(n_nops, 1)].imag
Expand All @@ -613,4 +613,4 @@ def test_multi_qubit_error_transfer_matrix(self):
I_transfer = 1 - np.einsum('...ii', U)/d**2
self.assertArrayAlmostEqual(Up, U)
self.assertArrayAlmostEqual(I_transfer, I_fidelity.sum(),
rtol=1e-3)
atol=1e-4)

0 comments on commit 9a88506

Please sign in to comment.