Skip to content

Commit

Permalink
🔧 Increased timeouts
Browse files Browse the repository at this point in the history
  • Loading branch information
pehamTom authored and burgholzer committed Sep 9, 2024
1 parent e9b47c0 commit 02f604d
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions test/python/ft_stateprep/test_stateprep.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ def test_heuristic_prep_consistent(code: CSSCode, request) -> None: # type: ign
def test_gate_optimal_prep_consistent(code: CSSCode, request) -> None: # type: ignore[no-untyped-def]
"""Check that gate_optimal_prep_circuit returns a valid circuit with the correct stabilizers."""
code = request.getfixturevalue(code)
sp_circ = gate_optimal_prep_circuit(code, max_timeout=3)
sp_circ = gate_optimal_prep_circuit(code, max_timeout=5)
assert sp_circ is not None
assert sp_circ.zero_state

Expand All @@ -151,7 +151,7 @@ def test_depth_optimal_prep_consistent(code: CSSCode, request) -> None: # type:
"""Check that depth_optimal_prep_circuit returns a valid circuit with the correct stabilizers."""
code = request.getfixturevalue(code)

sp_circ = depth_optimal_prep_circuit(code, max_timeout=3)
sp_circ = depth_optimal_prep_circuit(code, max_timeout=10)
assert sp_circ is not None
circ = sp_circ.circ
max_cnots = np.sum(code.Hx) + np.sum(code.Hz) # type: ignore[operator]
Expand All @@ -168,7 +168,7 @@ def test_depth_optimal_prep_consistent(code: CSSCode, request) -> None: # type:
def test_plus_state_gate_optimal(code: CSSCode, request) -> None: # type: ignore[no-untyped-def]
"""Test synthesis of the plus state."""
code = request.getfixturevalue(code)
sp_circ_plus = gate_optimal_prep_circuit(code, max_timeout=3, zero_state=False)
sp_circ_plus = gate_optimal_prep_circuit(code, zero_state=False, max_timeout=5)

assert sp_circ_plus is not None
assert not sp_circ_plus.zero_state
Expand All @@ -183,7 +183,7 @@ def test_plus_state_gate_optimal(code: CSSCode, request) -> None: # type: ignor
assert eq_span(code.Hz, z)
assert eq_span(np.vstack((code.Hx, code.Lx)), x)

sp_circ_zero = gate_optimal_prep_circuit(code, max_timeout=5, zero_state=True)
sp_circ_zero = gate_optimal_prep_circuit(code, zero_state=True, max_timeout=5)

assert sp_circ_zero is not None

Expand Down Expand Up @@ -291,7 +291,7 @@ def test_optimal_tetrahedral_verification_circuit(tetrahedral_code_sp: StatePrep
"""
circ = tetrahedral_code_sp

ver_stabs_layers = gate_optimal_verification_stabilizers(circ, x_errors=True, max_ancillas=1, max_timeout=5)
ver_stabs_layers = gate_optimal_verification_stabilizers(circ, x_errors=True, max_ancillas=1, max_timeout=10)

assert len(ver_stabs_layers) == 1 # 1 layer of verification measurements

Expand Down Expand Up @@ -352,7 +352,7 @@ def test_not_full_ft_opt_cc5(color_code_d5_sp: StatePrepCircuit) -> None:
"""
circ = color_code_d5_sp

ver_stabs_layers = gate_optimal_verification_stabilizers(circ, x_errors=True, max_ancillas=3, max_timeout=5)
ver_stabs_layers = gate_optimal_verification_stabilizers(circ, x_errors=True, max_ancillas=3, max_timeout=10)

assert len(ver_stabs_layers) == 2 # 2 layers of verification measurements

Expand Down Expand Up @@ -421,12 +421,14 @@ def test_full_ft_opt_cc5(color_code_d5_sp: StatePrepCircuit) -> None:
"""Test that the optimal verification is also correct for higher distance.
Include Z errors.
Due to time constraints, we set the timeout for each search to 2 seconds.
Due to time constraints, we set a timeout for each search..
"""
circ = color_code_d5_sp

circ_ver_full_ft = gate_optimal_verification_circuit(circ, max_ancillas=3, max_timeout=5, full_fault_tolerance=True)
circ_ver_x_ft = gate_optimal_verification_circuit(circ, max_ancillas=3, max_timeout=5, full_fault_tolerance=False)
circ_ver_full_ft = gate_optimal_verification_circuit(
circ, max_ancillas=3, full_fault_tolerance=True, max_timeout=10
)
circ_ver_x_ft = gate_optimal_verification_circuit(circ, max_ancillas=3, full_fault_tolerance=False, max_timeout=10)
assert circ_ver_full_ft.num_nonlocal_gates() > circ_ver_x_ft.num_nonlocal_gates()
assert circ_ver_full_ft.depth() > circ_ver_x_ft.depth()

Expand All @@ -450,12 +452,12 @@ def test_error_detection_code() -> None:
circ = heuristic_prep_circuit(code)

circ_ver_correction = gate_optimal_verification_circuit(
circ, max_ancillas=3, max_timeout=5, full_fault_tolerance=False
circ, max_ancillas=3, full_fault_tolerance=False, max_timeout=5
)

circ.set_error_detection(True)
circ_ver_detection = gate_optimal_verification_circuit(
circ, max_ancillas=3, max_timeout=5, full_fault_tolerance=False
circ, max_ancillas=3, full_fault_tolerance=False, max_timeout=5
)

assert circ_ver_detection.num_qubits > circ_ver_correction.num_qubits
Expand Down

0 comments on commit 02f604d

Please sign in to comment.