Skip to content

Cherie000/surface-code-simulation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Surface Code Simulation (Qiskit & Stim)

This project implements and simulates the surface code, one of the leading quantum error-correcting codes, using two frameworks:

  • Qiskit for circuit-based simulations
  • Stim for fast stabilizer circuit sampling

It explores how stabilizer measurements detect Pauli errors (X, Y, Z) and how noise affects logical qubits.

Project Structure


Qiskit/
├── Modular_Simple_Circuit.ipynb        # Modular Surface Code using Qiskit
├── Simple Model Circuit 4 qubits.ipynb # Example with 4-qubit entangled state
├── SurfaceCode.py                      # Qiskit-based surface code implementation

STIM/
├── Modular_Simple_Circuit_STIM.ipynb   # Modular Surface Code using Stim
├── SurfaceCodeSTIM.py                  # Stim-based surface code simulator

README.md                                # Project documentation

Features

  • Surface code construction for arbitrary distance (d).
  • Stabilizer measurement circuits (X and Z stabilizers) on a planar 2D lattice.
  • Noise models: Pauli depolarizing noise ((X, Y, Z) errors with probability (p)).
  • Visualization tools:
    • Single-shot stabilizer measurement timelines.
    • Histograms of multi-shot syndrome distributions.

Example: Syndrome Measurement

  • X stabilizers detect Z and Y errors.
  • Z stabilizers detect X and Y errors.
  • Y errors flip both stabilizer types.

A minimal-weight perfect matching (MWPM) decoder can then be applied to infer the most likely error configuration.

Background

The surface code encodes logical qubits in a 2D grid of physical qubits with local stabilizer checks. A distance-(d) code can detect and correct up to (\left\lfloor \frac{d-1}{2} \right\rfloor) errors.

Next Steps

  • Implement a decoder (e.g., Edmonds’ Minimum-Weight Perfect Matching).
  • Explore logical error rates as a function of noise probability (p).
  • Extend to rotated surface codes or other topological codes.

About

This project implements a modular distance-n surface code using both Qiskit and Stim to explore quantum error correction. The goal is to provide an educational and extensible framework for understanding how surface codes detect and correct errors in quantum systems.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors