Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
renatomello committed Oct 15, 2023
1 parent 1391f48 commit 5291a4b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions tests/test_gates_channels.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,20 +94,20 @@ def test_kraus_channel(backend, pauli_order):
channel = gates.KrausChannel(0, [a_1, a_2])

backend.assert_allclose(
backend.calculate_norm(channel.to_liouville(backend=backend) - test_superop)
float(backend.calculate_norm_density_matrix(channel.to_liouville(backend=backend) - test_superop, order=2))
< PRECISION_TOL,
True,
)
backend.assert_allclose(
backend.calculate_norm(channel.to_choi(backend=backend) - test_choi)
float(backend.calculate_norm_density_matrix(channel.to_choi(backend=backend) - test_choi, order=2))
< PRECISION_TOL,
True,
)
backend.assert_allclose(
backend.calculate_norm(
float(backend.calculate_norm(
channel.to_pauli_liouville(pauli_order=pauli_order, backend=backend)
- test_pauli
)
))
< PRECISION_TOL,
True,
)
Expand Down Expand Up @@ -212,7 +212,7 @@ def test_pauli_noise_channel(backend, pauli_order):
liouville = gates.PauliNoiseChannel(0, list(zip(basis, pnp))).to_pauli_liouville(
normalize=True, pauli_order=pauli_order, backend=backend
)
norm = backend.calculate_norm(backend.to_numpy(liouville) - test_representation)
norm = float(backend.calculate_norm_density_matrix(backend.to_numpy(liouville) - test_representation, order=2))

assert norm < PRECISION_TOL

Expand Down Expand Up @@ -341,7 +341,7 @@ def test_thermal_relaxation_channel(backend, t_1, t_2, time, excpop):
target_state = backend.cast(target_state, dtype=target_state.dtype)

backend.assert_allclose(
backend.calculate_norm(final_state - target_state) < PRECISION_TOL, True
float(backend.calculate_norm_density_matrix(final_state - target_state, order=2)) < PRECISION_TOL, True
)


Expand Down
2 changes: 1 addition & 1 deletion tests/test_models_circuit_features.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ def test_repeated_execute_probs_and_freqs(backend, nqubits):
test_probabilities = backend.cast(test_probabilities, dtype=float)
print(result.probabilities())
backend.assert_allclose(
backend.calculate_norm(result.probabilities() - test_probabilities)
float(backend.calculate_norm(result.probabilities() - test_probabilities))
< PRECISION_TOL,
True,
)
Expand Down

0 comments on commit 5291a4b

Please sign in to comment.