Skip to content

Commit

Permalink
🎨 pre-commit fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
pre-commit-ci[bot] committed Jul 1, 2024
1 parent 7a4113b commit 68a0726
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/mqt/qecc/ft_stateprep/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
heuristic_prep_circuit,
heuristic_verification_circuit,
heuristic_verification_stabilizers,
naive_verification_circuit
naive_verification_circuit,
)

__all__ = [
Expand All @@ -26,5 +26,5 @@
"heuristic_prep_circuit",
"heuristic_verification_circuit",
"heuristic_verification_stabilizers",
"naive_verification_circuit"
"naive_verification_circuit",
]
15 changes: 7 additions & 8 deletions test/python/ft_stateprep/test_simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

from typing import TYPE_CHECKING

import pytest
import numpy as np
import pytest

from mqt.qecc import CSSCode
from mqt.qecc.ft_stateprep import (
LutDecoder,
NoisyNDFTStatePrepSimulator,
heuristic_prep_circuit,
heuristic_verification_circuit,
LutDecoder,
)

if TYPE_CHECKING: # pragma: no cover
Expand Down Expand Up @@ -42,19 +42,19 @@ def test_lut(steane_code: CSSCode):

lut.generate_x_lut()
lut.generate_z_lut()

assert len(lut.x_lut) != 0
assert lut.x_lut is lut.z_lut # Code is self dual so luts should be the same

error_1 = np.zeros(steane_code.n, dtype=np.int8)
error_1[0] = 1

error_w1 = (steane_code.Hx[0] + error_1) % 2
syndrome_1 = steane_code.get_x_syndrome(error_w1)
estimate_1 = lut.decode_x(syndrome_1.astype(np.int8))
assert steane_code.stabilizer_eq_x_error(estimate_1, error_1)
assert steane_code.stabilizer_eq_z_error(estimate_1, error_1)

error_2 = np.zeros(steane_code.n, dtype=np.int8)
error_2[0] = 1
error_2[1] = 1
Expand All @@ -65,7 +65,7 @@ def test_lut(steane_code: CSSCode):
# Weight 2 error should have be estimated to be weight 1
assert not steane_code.stabilizer_eq_x_error(estimate_2, error_2)
assert np.sum(estimate_2) == 1

error_3 = np.ones((steane_code.n), dtype=np.int8)
error_w3 = (steane_code.Hx[0] + error_3) % 2
syndrome_3 = steane_code.get_x_syndrome(error_w3)
Expand All @@ -74,7 +74,7 @@ def test_lut(steane_code: CSSCode):
assert not steane_code.stabilizer_eq_x_error(estimate_3, error_3)
assert steane_code.stabilizer_eq_x_error(estimate_3, np.zeros(steane_code.n))
assert np.sum(estimate_3) == 0


def test_non_ft_sim(steane_code: CSSCode, non_ft_steane_zero: QuantumCircuit):
tol = 5e-4
Expand All @@ -94,4 +94,3 @@ def test_ft_sim(steane_code: CSSCode, ft_steane_circ: QuantumCircuit):
p_l, _, _, _ = simulator.logical_error_rate()

assert p_l - tol < lower

0 comments on commit 68a0726

Please sign in to comment.