mqt.qecc.circuit_synthesis.state_prep_det

Synthesizing deterministic state preparation circuits for d<5 CSS codes.

Classes

DeterministicVerification

Class to store deterministic verification stabilizers and corrections.

DeterministicVerificationHelper

Class to compute the deterministic verification stabilizers and corrections for a given state preparation circuit.

Functions

deterministic_correction(fault_set, verification_gens, ...) → DeterministicCorrection

Returns a deterministic verification for non-deterministic verification stabilizers.

deterministic_correction_single_outcome(fault_set, ...) → Recovery

Returns the deterministic recovery for a set of errors.

correction_stabilizers(fault_set, measurement_gens, ...) → Recovery | None

Return deterministic verification stabilizers with corresponding corrections using z3.

Module Contents

class DeterministicVerification(nd_verification_stabs: Verification, det_correction: DeterministicCorrection, hook_corrections: list[DeterministicCorrection] | None = None)[source]

Class to store deterministic verification stabilizers and corrections.

copy() → DeterministicVerification[source]

Return a copy of the deterministic verification object.

num_ancillas_verification() → int[source]

Return the number of ancillas needed for the verification.

num_cnots_verification() → int[source]

Return the number of CNOTs needed for the verification.

num_ancillas_correction() → int[source]

Return the number of ancillas needed for the correction.

stat_ancillas_correction(fun: Callable[..., int]) → int[source]

Return some statistics on the ancillas in the deterministic correction using the function fun.

Parameters:

fun – The function to use for the statistics, e.g. sum, max, min, etc.

num_cnots_correction() → int[source]

Return the number of CNOTs needed for the correction.

stat_cnots_correction(fun: Callable[..., int]) → int[source]

Return some statistics on the CNOTs in the deterministic correction using the function fun.

Parameters:

fun – The function to use for the statistics, e.g. sum, max, min, etc.

num_ancillas_hooks() → int[source]

Return the number of ancillas needed for the hook corrections.

num_cnots_hooks() → int[source]

Return the number of CNOTs needed for the hook corrections (two per ancilla).

num_ancillas_hook_corrections() → int[source]

Return the number of ancillas needed for the hook corrections of the verification stabilizers.

stat_ancillas_hook_corrections(fun: Callable[..., int]) → int[source]

Return some statistics on the ancillas in the hook corrections of the verification stabilizers using the function fun.

Parameters:

fun – The function to use for the statistics, e.g. sum, max, min, etc.

num_cnots_hook_corrections() → int[source]

Return the number of CNOTs needed for the hook corrections of the verification stabilizers.

stat_cnots_hook_corrections(fun: Callable[..., int]) → int[source]

Return some statistics on the CNOTs in the hook corrections of the verification stabilizers using the function fun.

Parameters:

fun – The function to use for the statistics, e.g. sum, max, min, etc.

num_ancillas_total() → int[source]

Return the total number of ancillas needed for the verification and correction.

num_cnots_total() → int[source]

Return the total number of CNOTs needed for the verification and correction.

num_branches_det_correction() → int[source]

Return the number of branches in the deterministic correction.

num_branches_hook_corrections() → int[source]

Return the number of branches in the hook corrections of the verification stabilizers.

num_branches_total() → int[source]

Return the total number of branches in the verification and correction.

class DeterministicVerificationHelper(state_prep: FaultyStatePrepCircuit, use_optimal_verification: bool = True, verify_x_first: bool = True)[source]

Class to compute the deterministic verification stabilizers and corrections for a given state preparation circuit.

get_solution(min_timeout: int = 1, max_timeout: int = 3600, max_ancillas: int | None = None, use_optimal_verification: bool = True) → tuple[DeterministicVerification, DeterministicVerification][source]

Returns a tuple representing the first layer, second layer and hook error corrections.

get_global_solution(min_timeout: int = 1, max_timeout: int = 3600, max_ancillas: int | None = None) → tuple[DeterministicVerification, DeterministicVerification][source]

Returns the optimal non-deterministic verification stabilizers for the first and second layer regarding the number of ancillas and CNOTs.

deterministic_correction(fault_set: PureFaultSet, verification_gens: numpy.typing.NDArray[numpy.int8], correction_gens: numpy.typing.NDArray[numpy.int8], nd_d3_verification_stabilizers: list[numpy.typing.NDArray[numpy.int8]], min_timeout: int = 1, max_timeout: int = 3600, max_ancillas: int | None = None) → DeterministicCorrection[source]

Returns a deterministic verification for non-deterministic verification stabilizers.

It computes the corresponding fault set and then solves the problem if finding optimal deterministic verification stabilizers for each non-deterministic verification outcome separately.

Parameters:
  • fault_set – The set of errors to consider for the deterministic verification.

  • verification_gens – The stabilizer generators used for verification.

  • correction_gens – The stabilizer generators the faults can be multiplied by.

  • nd_d3_verification_stabilizers – The non-deterministic verification stabilizers to be measured.

  • min_timeout – The minimum time in seconds to run the verification stabilizers.

  • max_timeout – The maximum time in seconds to run the verification stabilizers.

  • max_ancillas – The maximum number of ancillas to use in the verification stabilizers.

deterministic_correction_single_outcome(fault_set: PureFaultSet, verification_gens: numpy.typing.NDArray[numpy.int8], correction_gens: numpy.typing.NDArray[numpy.int8], min_timeout: int, max_timeout: int, max_ancillas: int | None = None) → Recovery[source]

Returns the deterministic recovery for a set of errors.

Geometrically increases the number of ancilla qubits until a solution is found. Then, first the number of ancillas is optimized and then the number of CNOTs.

Parameters:
  • fault_set – The set of errors to consider for the deterministic verification.

  • verification_gens – The stabilizer generators used for verification.

  • correction_gens – The stabilizer generators the faults can be multiplied by.

  • min_timeout – The minimum time in seconds to run the verification stabilizers.

  • max_timeout – The maximum time in seconds to run the verification stabilizers.

  • max_ancillas – The maximum number of ancillas to use in the verification stabilizers.

correction_stabilizers(fault_set: PureFaultSet, measurement_gens: numpy.typing.NDArray[numpy.int8], correction_gens: numpy.typing.NDArray[numpy.int8], num_anc: int, num_cnot: int) → Recovery | None[source]

Return deterministic verification stabilizers with corresponding corrections using z3.