Code
qcr:2604.99110.2

Bacon-Shor Code (2x2)

Implementation of the smallest non-trivial Bacon-Shor subsystem code on a 2x2 grid of 4 data qubits in the X basis. Subsystem codes split the codespace into a logical and gauge subsystem, enabling syndrome extraction with only weight-2 (two-qubit) checks instead of the higher-weight stabilizers needed by surface or Steane codes, simpler circuits and lower error propagation. The circuit performs three rounds: X-stabilizer checks (X0*X2, X1*X3) decomposed as Hadamard-CNOT-measure-CNOT-Hadamard, Z-stabilizer checks (Z0*Z1, Z2*Z3) decomposed as CNOT-measure-CNOT, and a final X-basis data readout. The circuit construction follows the decomposition approach from Gidney's more-bacon-less-threshold repository. Simulated on Qiskit Aer with 1000 shots producing 8-bit measurement records.
QEC
Qubit
Circuit-based
Uploaded 2 months ago
195
Views
GitHub4
Citing this entry? Use this QCR ID
Uploaded by
HQ
Hello QCR

Overview

Assembly

1 available
QCRepository/qcr-circuit-examples
40
README.md

Bacon-Shor Code (2x2)

The Bacon-Shor code is a subsystem code — a family of quantum error-correcting codes that sits between stabilizer codes and topological codes in terms of structure. It was developed by combining ideas from Dave Bacon's operator quantum error correction with Peter Shor's original 9-qubit code.

What makes subsystem codes special is that they split the codespace into a logical subsystem (the information you care about) and a gauge subsystem (degrees of freedom you can ignore). This means syndrome extraction only requires measuring weight-2 operators (two-qubit checks) instead of the higher-weight stabilizers needed by surface codes or Steane codes. Fewer qubits per check means simpler circuits and lower error propagation during syndrome measurement — a significant practical advantage.

The 2x2 layout

This example implements the smallest non-trivial Bacon-Shor code: a grid of 4 data qubits encoding information in the X basis. The syndrome extraction proceeds in three rounds:

  1. X-stabilizer checks — multi-Pauli product measurements and (rows), decomposed into Hadamard-CNOT-measure-CNOT-Hadamard sequences.
  2. Z-stabilizer checks — multi-Pauli product measurements and (columns), decomposed into CNOT-measure-CNOT sequences.
  3. Data readout — X-basis measurement of all 4 data qubits.

The circuit construction follows the decomposition approach from Gidney's more-bacon-less-threshold repository.

Getting started

python -m venv .venv && source .venv/bin/activate
pip install -r requirements.lock
python bacon_shor_code.py

The output parses each 8-bit measurement record into its components (data readout, Z-syndromes, X-syndromes), verifies that X-stabilizer syndromes are clean across all shots, and summarizes the result distribution.

Dependencies

  • Python 3.12
  • Qiskit (< 2.0)
  • Qiskit Aer

References

License

Apache 2.0 — see LICENSE.

Join the Discussion

Comments (0)

No comments yet. Be the first to share your thoughts!