Skip to main content

benchmark_decoder

Function benchmark_decoder 

Source
pub fn benchmark_decoder(
    decoder: &dyn SurfaceCodeDecoder,
    distance: u32,
    error_rate: f64,
    rounds: u32,
) -> DecoderBenchmark
Expand description

Benchmark a decoder by generating random syndromes at a given physical error rate and measuring decode accuracy and throughput.

For each round, we generate a random syndrome where each stabilizer measurement has probability error_rate of being a defect. We then decode and check whether the correction introduces a logical error.

A simple heuristic is used: if the syndrome has no defects, the correct answer is no correction. If it does have defects, we check whether the decoder’s logical outcome matches the expected parity.