Skip to main content

run_surface_code

Function run_surface_code 

Source
pub fn run_surface_code(config: &SurfaceCodeConfig) -> Result<SurfaceCodeResult>
Expand description

Run a surface code error correction simulation.

Currently only distance 3 is supported. The simulation:

  1. Initializes all qubits in |0> (the logical |0_L> state).
  2. For each cycle: injects noise, extracts the syndrome, decodes, and applies corrections.
  3. After all cycles, returns the syndrome history and error statistics.

§Logical error detection (simplified)

A logical Z error is detected by checking the parity of a representative row of data qubits. If the initial logical state was |0_L>, a flipped parity indicates a logical error. This is a coarse approximation; a full implementation would track the Pauli frame.

§Errors

Returns a ruqu_core::error::QuantumError on simulator failures.