Error Models

class panqec.error_models.BaseErrorModel

Base class for error models

abstract generate(code: StabilizerCode, error_rate: float, rng=None) ndarray

Generate errors for a given code and probability of failure

Parameters:
  • code (StabilizerCode) – Errors will be generated on the qubits of the provided code

  • error_rate (float) – Physical error rate

  • rng (numpy.random.Generator) – Random number generator (default=None resolves to numpy.random.default_rng())

Returns:

error – Error as an array of size 2n (with n the number of qubits) in the binary symplectic format

Return type:

np.ndarray

get_weights(code: StabilizerCode, error_rate: float, eps=1e-20) Tuple[ndarray, ndarray]

Get MWPM weights for deformed Pauli noise.

abstract property label: str

Label used in plots result files E.g. ‘PauliErrorModel X1 Y0 Z0’

abstract property params: dict

List of class arguments (as a dictionary), that can be saved and reused to instantiate the same error model

abstract probability_distribution(code: StabilizerCode, error_rate: float) Tuple

Probability distribution of X, Y and Z errors on all the qubits of a code. Can be used to generate errors and configure decoders.

Parameters:
  • code (StabilizerCode) – Code used for the error model

  • error_rate (float) – Physical error rate

Returns:

p_i, p_x, p_y, p_z – Probability distribution for I, X, Y and Z errors. Each probability is an array of size n (number of qubits)

Return type:

Tuple[np.ndarray]

class panqec.error_models.PauliErrorModel(r_x: float, r_y: float, r_z: float, deformation_name: str | None = None, deformation_kwargs: dict | None = None)

Pauli channel IID noise model.

The overal quantum channel takes the form

\[\mathcal{\rho}(\rho) = (1 - p)\rho + p(r_X X \rho X + r_Y Y \rho Y + r_Z Z \rho Z)\]

where it is required that \(r_X + r_Y + r_Z =1\).

__init__(r_x: float, r_y: float, r_z: float, deformation_name: str | None = None, deformation_kwargs: dict | None = None)

Initialize Pauli error model at a given rate of X, Y and Z errors, i.e. \(p_\sigma = p r_\sigma\) for \(\sigma \in \{X, Y, Z\}\), \(p\) the total error rate, and \(p_\sigma\) the probability of getting the error \(\sigma\) on each qubit.

Parameters:
  • r_x (float) – Rate of X errors

  • r_y (float) – Rate of Y errors

  • r_z (float) – Rate of Z errors

  • deformation_name (str, optional) – Name of the Clifford deformation to apply to the noise model. The Clifford deformation must be provided in the code class.

property direction: Tuple[float, float, float]

Rate of X, Y and Z errors, as given when initializing the error model

Returns:

(r_x, r_y, r_z) – Rate of X, Y and Z errors

Return type:

Tuple[float]

generate(code: StabilizerCode, error_rate: float, rng=None)

Generate errors for a given code and probability of failure

Parameters:
  • code (StabilizerCode) – Errors will be generated on the qubits of the provided code

  • error_rate (float) – Physical error rate

  • rng (numpy.random.Generator) – Random number generator (default=None resolves to numpy.random.default_rng())

Returns:

error – Error as an array of size 2n (with n the number of qubits) in the binary symplectic format

Return type:

np.ndarray

property label

Label used in plots result files E.g. ‘PauliErrorModel X1 Y0 Z0’

property params: dict

List of class arguments (as a dictionary), that can be saved and reused to instantiate the same code

probability_distribution(code: StabilizerCode, error_rate: float) Tuple

Probability distribution of X, Y and Z errors on all the qubits of a code. Can be used to generate errors and configure decoders.

Parameters:
  • code (StabilizerCode) – Code used for the error model

  • error_rate (float) – Physical error rate

Returns:

p_i, p_x, p_y, p_z – Probability distribution for I, X, Y and Z errors. Each probability is an array of size n (number of qubits)

Return type:

Tuple[np.ndarray]