Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Oct 15, 2023
1 parent 5291a4b commit 6270d24
Showing 1 changed file with 26 additions and 8 deletions.
34 changes: 26 additions & 8 deletions tests/test_gates_channels.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,20 +94,30 @@ def test_kraus_channel(backend, pauli_order):
channel = gates.KrausChannel(0, [a_1, a_2])

backend.assert_allclose(
float(backend.calculate_norm_density_matrix(channel.to_liouville(backend=backend) - test_superop, order=2))
float(
backend.calculate_norm_density_matrix(
channel.to_liouville(backend=backend) - test_superop, order=2
)
)
< PRECISION_TOL,
True,
)
backend.assert_allclose(
float(backend.calculate_norm_density_matrix(channel.to_choi(backend=backend) - test_choi, order=2))
float(
backend.calculate_norm_density_matrix(
channel.to_choi(backend=backend) - test_choi, order=2
)
)
< PRECISION_TOL,
True,
)
backend.assert_allclose(
float(backend.calculate_norm(
channel.to_pauli_liouville(pauli_order=pauli_order, backend=backend)
- test_pauli
))
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 +222,11 @@ 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 = float(backend.calculate_norm_density_matrix(backend.to_numpy(liouville) - test_representation, order=2))
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 +355,11 @@ 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(
float(backend.calculate_norm_density_matrix(final_state - target_state, order=2)) < PRECISION_TOL, True
float(
backend.calculate_norm_density_matrix(final_state - target_state, order=2)
)
< PRECISION_TOL,
True,
)


Expand Down

0 comments on commit 6270d24

Please sign in to comment.