mqt.qecc.circuit_synthesis.simulation_det

Simulation of deterministic state preparation circuits using qsample (https://github.com/dpwinter/qsample).

Exceptions

UnsupportedCodeError

Raised when the code is not supported by the simulator.

Classes

NoisyDFTStatePrepSimulator

Class to simulate the state preparation circuits using qsample (https://github.com/dpwinter/qsample).

Functions

return_correction(outcome, corrections, zero_state) → qsample.Circuit

Return the det correction circuit for the given outcome of the D-verification.

ndv_outcome_check(outcome, correction_index, ...) → bool

Check if the outcome of the AND-verification is equal to the given outcome.

decode_failure(measurements, code, decoder, ...) → bool

Check if the decoding failed.

qiskit_to_qsample(qiskit_circuit) → qsample.Circuit

Convert a Qiskit circuit to a qsample circuit. Only supports H, X, Y, Z, CX, and MEASURE gates.

Module Contents

exception UnsupportedCodeError

Bases: ValueError

Raised when the code is not supported by the simulator.

return_correction(outcome: int, corrections: dict[int, numpy.typing.NDArray[numpy.int8]], zero_state: bool) → qsample.Circuit

Return the det correction circuit for the given outcome of the D-verification.

ndv_outcome_check(outcome: int, correction_index: int, num_measurements: int, cutoff: int, flag: bool) → bool

Check if the outcome of the AND-verification is equal to the given outcome.

decode_failure(measurements: int, code: CSSCode, decoder: LutDecoder, zero_state: bool, num_measurements: int) → bool

Check if the decoding failed.

class NoisyDFTStatePrepSimulator(state_prep_circuit: QuantumCircuit, verifications: tuple[DeterministicVerification, DeterministicVerification], code: CSSCode, err_model: type[qsample.ErrorModel] = qs.noise.E1_1, zero_state: bool = True)

Class to simulate the state preparation circuits using qsample (https://github.com/dpwinter/qsample).

dss_logical_error_rates(err_params: dict[str, list[float]], p_max: dict[str, float], dss_l: int = 3, shots: int = 1000, callbacks: qsample.callbacks.Callback | qsample.callbacks.CallbackList | None = None) → list[numpy.typing.NDArray[numpy.float64]]

Calculate the logical error rate of the deterministic state preparation circuit using subset sampling.

For more detail on the parameters see the qsample documentation (https://dpwinter.github.io/qsample/).

Parameters:
  • err_params – The error parameters (physical errors) for the error model.

  • p_max – The physical error rate to sample at for the subset sampling.

  • dss_l – The sampling depth for the subset sampling.

  • shots – The number of shots to use for the simulation.

  • callbacks – A list of callback functions to call after each layer from qsample.

mc_logical_error_rates(err_params: dict[str, list[float]], shots: int = 10000, callbacks: qsample.callbacks.Callback | qsample.callbacks.CallbackList | None = None) → list[numpy.typing.NDArray[numpy.float64]]

Calculate the logical error rate of the deterministic state preparation circuit using direct Monte Carlo sampling.

Parameters:
  • err_params – The error parameters (physical errors) for the error model.

  • shots – The number of shots to use for the simulation.

  • callbacks – A list of callback functions to call after each layer from qsample.

qiskit_to_qsample(qiskit_circuit: QuantumCircuit) → qsample.Circuit

Convert a Qiskit circuit to a qsample circuit. Only supports H, X, Y, Z, CX, and MEASURE gates.