Overview

Introduction

qecsim is a Python 3 package for simulating quantum error correction using stabilizer codes.

It is lightweight, modular and extensible, allowing additional codes, error models and decoders to be plugged in.

Components

qecsim includes three key abstract classes: qecsim.model.StabilizerCode, qecsim.model.ErrorModel and qecsim.model.Decoder.

StabilizerCode

n_k_d
stabilizers
logical_xs
logical_zs
logicals

validate()

ErrorModel

probability_distribution(probability):tuple
generate(code, probability):error

Decoder

decode(syndrome):recovery

A simulation run is executed by passing implementations of the key classes, along with an error_probability to the function qecsim.app.run_once().

app

run_once(code, error_model, decoder, error_probability):run_data

1. \(S \leftarrow\) code.stabilizers
2. \(L \leftarrow\) code.logicals
3. \(e \leftarrow\) error_model.generate(code, error_probability)
4. \(y \leftarrow e \odot S^T\)
5. \(r \leftarrow\) decoder.decode(code, \(y\))
6. sanity check \(r \odot S^T = y\)
7. success \(\iff (r \oplus e) \odot L^T = 0\)

run(code, error_model, decoder, error_probabilities, max_runs, max_failures):runs_data

merge(runs_data_list, …):runs_data_list

Notes

  • The binary symplectic product \(\odot\) is defined as \(A \odot B \equiv A \Lambda B \bmod 2\) where \(\Lambda = \left[\begin{matrix} 0 & I \\ I & 0 \end{matrix}\right]\).

  • Pauli operators - stabilizers, logicals, error, recovery - are represented in binary symplectic form by NumPy arrays:

    numpy.array([0, 0, 1, 1, 0, 1, 1, 0])  # [0 0 1 1 | 0 1 1 0] = IZYX
    
  • The qecsim.app module also includes functions to execute fault-tolerant simulations, see qecsim.app.run_once_ftp() and qecsim.app.run_ftp(), which delegate to a fault-tolerant decoder implementation of qecsim.model.DecoderFTP.

  • The qecsim.paulitools module provides utility functions for manipulating Pauli operators in string and binary symplectic form.

  • The qecsim.graphtools and qecsim.tensortools modules provide support for graph matching and tensor network contraction as used by some decoder implementations.

Implementations

Stablizer code implementations include:

Error model implementations include:

Decoder implementations include:

Further implementations can be added by extending the key abstract models.