mqt.qecc.circuit_synthesis.simulation

Simulation of Non-deterministic fault tolerant state preparation.

Classes

NoisyNDFTStatePrepSimulator

Base class for simulating noisy quantum state preparation circuits with a depolarizing noise model and support for error correction using CSS codes.

VerificationNDFTStatePrepSimulator

Class for simulating noisy state preparation circuit using stabilizer measurements to detect in a verification circuit.

SteaneNDFTStatePrepSimulator

Class for simulating Steane-type noisy state preparation circuit.

LutDecoder

Lookup table decoder for a CSSCode.

Module Contents

class NoisyNDFTStatePrepSimulator(state_prep_circ: qiskit.QuantumCircuit | stim.Circuit | CNOTCircuit, code: CSSCode, zero_state: bool = True, decoder: LutDecoder | None = None)[source]

Bases: abc.ABC

Base class for simulating noisy quantum state preparation circuits with a depolarizing noise model and support for error correction using CSS codes.

logical_error_rate(noise: NoiseModel, shots: int = 100000, shots_per_batch: int = 100000, at_least_min_errors: bool = True, min_errors: int = 500) → tuple[float, float, int, int][source]

Estimate the logical error rate of the code.

Parameters:
  • noise – The noise model to apply.

  • shots – The number of shots to use.

  • shots_per_batch – The number of shots per batch.

  • at_least_min_errors – Whether to continue simulating until at least min_errors are found.

  • min_errors – The minimum number of errors to find before stopping.

secondary_logical_error_rate(noise: NoiseModel, p: float, shots: int = 100000, shots_per_batch: int = 100000, at_least_min_errors: bool = True, min_errors: int = 500) → tuple[float, float, int, int][source]

Estimate the secondary logical error rate of the code.

For a zero (plus) state, we cannot directly estimate whether the circuit is strictly fault-tolerant with respect to Z (X) errors because a logical error of that kind cannot happen. This method is used to estimate the logical error rate for a zero (plus) state using a secondary error gadget. The prepared qubit is used as the ancilla in Steane-type QEC of an ancillary state prepared in the opposite basis (for a zero state, the plus state is used and vice-versa). The prepared qubit is assumed to be subject to uniform depolarizing noise of strength p.

Parameters:
  • noise – The noise model to apply.

  • p – Noise to apply to the gadget.

  • shots – The number of shots to use.

  • shots_per_batch – The number of shots per batch.

  • at_least_min_errors – Whether to continue simulating until at least min_errors are found.

  • min_errors – The minimum number of errors to find before stopping.

Returns:

The logical error rate and the acceptance rate of the protocol.

plot_state_prep(ps: list[float], min_errors: int = 500, p_idle_factor: float = 1.0, kind: str = 'primary') → None[source]

Plot the logical error rate and acceptance rate as a function of the physical error rate.

Parameters:
  • ps – The physical error rates to plot.

  • min_errors – The minimum number of errors to find before stopping.

  • p_idle_factor – Factor to scale the idling error rate depending on ps.

  • kind – Which error rates to plot. Can be “primary”, “secondary”, or “all”.

class VerificationNDFTStatePrepSimulator(state_prep_circ: qiskit.QuantumCircuit | stim.Circuit | CNOTCircuit, code: CSSCode, zero_state: bool = True, decoder: LutDecoder | None = None)[source]

Bases: NoisyNDFTStatePrepSimulator

Class for simulating noisy state preparation circuit using stabilizer measurements to detect in a verification circuit.

class SteaneNDFTStatePrepSimulator(circ1: qiskit.QuantumCircuit, circ2: qiskit.QuantumCircuit, code: CSSCode, circ3: qiskit.QuantumCircuit | None = None, circ4: qiskit.QuantumCircuit | None = None, zero_state: bool = True, decoder: LutDecoder | None = None)[source]

Bases: NoisyNDFTStatePrepSimulator

Class for simulating Steane-type noisy state preparation circuit.

A state is checked using multiple copies of the state preparation circuit, which are connected using transversal CNOTs.

class LutDecoder(code: CSSCode, init_luts: bool = True)[source]

Lookup table decoder for a CSSCode.

batch_decode_x(syndromes: numpy.typing.NDArray[numpy.int8]) → numpy.typing.NDArray[numpy.int8][source]

Decode the X errors given a batch of syndromes.

batch_decode_z(syndromes: numpy.typing.NDArray[numpy.int8]) → numpy.typing.NDArray[numpy.int8][source]

Decode the Z errors given a batch of syndromes.

decode_x(syndrome: numpy.typing.NDArray[numpy.int8]) → numpy.typing.NDArray[numpy.int8][source]

Decode the X errors given a syndrome.

decode_z(syndrome: numpy.typing.NDArray[numpy.int8]) → numpy.typing.NDArray[numpy.int8][source]

Decode the Z errors given a syndrome.

generate_x_lut() → None[source]

Generate the lookup table for the X errors.

generate_z_lut() → None[source]

Generate the lookup table for the Z errors.