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:
- Initializes all qubits in |0> (the logical |0_L> state).
- For each cycle: injects noise, extracts the syndrome, decodes, and applies corrections.
- 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.