Union-find decoders for CSS codes. An explanation of all algorithms can be found here: https://arxiv.org/abs/2407.15988.
- Fast decoding of topological codes.
- Decoding of general qLDPC codes.
- Include qubit erasure/loss into the decoding.
- Thresholds of the 2d, (2+1)d toric code are on par with https://arxiv.org/abs/1709.06218.
If a compiler such as gcc is present on the used system, compilation can be done with the following commands:
$ pip install meson ninja
$ meson setup build --buildtype=release
$ cd build/
$ ninja
After compilation, you can use the decoder from Python via the library libSpeedDecoder.so (see py_wrapper/py_decoder.py).
For using Python, there are several example scripts in the folder py_wrapper/:
example_toric_code.pyapplies Pauli errors and erasures to a 2d toric code (periodic boundary conditions) and visualizes the decoding.example_surface_code.pyapplies Pauli errors and erasures to a 2d surface code (with boundaries) and visualizes the decoding.example_surface_code_simulate.pysimulates the logical error rate for a 2d surface/toric (batch evaluation).example_bb_codes.pysimulates the logical error rate for bivariate bicycle codes from https://arxiv.org/pdf/2308.07915 (batch evaluation)
When using Python for simulations with many repetitions for averaging, batch evaluation should be used. Otherwise, the library libSpeedDecoder.so is called very often which may affect the overall running time. Instead of using Python, the C-code can be used independently. C-code examples for running simulations can be found in the folder examples/.
Note: The decoder assumes CSS codes where the parity-check matrices Hx, Hz can be decoded separately. Therefore, you need to specify either of the two parity-check matrices. The dimensions of syndromes, erasures, and corrections are given by the dimension of this parity-check (sub-)matrix. Using parity-check matrices in symplectic representation is currently not supported.
The repository contains all algorithms from https://arxiv.org/abs/2407.15988. In contrast to the original decoder from https://arxiv.org/abs/1709.06218, our decoders grow clusters node-by-node instead of cluster-by-cluster for syndrome validation, using breadth-first graph traversal of the Tanner graph and not tracking cluster boundaries. In https://arxiv.org/abs/2407.15988, we label different decoding algorithms with numbers 1-4. The implementation of Algorithms 1, 2, and 4 can be found in src/decoder_main.c. These algorithms can be used for decoding topological codes where every data qubit participates in no more than two parity checks. Algorithm 3 can be used for decoding general CSS qLDPC codes and its implementation can be found in src/decoder_ldpc.c where also code from src/stabilizer_main.c is used. Compared to Algorithm 2, Algorithm 3 is less performant regarding speed and error threshold when applied to topological codes.