Trade-offs in Gauss's law error correction for lattice gauge theory quantum simulations
Abstract
Gauss' Law in Lattice Gauge Theory Simulations Setup Unzip the downloaded Zenodo package to a folder named gauss_law_qec and run cd gauss_law_qec to switch the current directory to the package directory. Please use Python version 3.10, 3.11, 3.12, or 3.13 (Pymatching has wheels up to 3.13). We provide instructions for Unix systems (Linux/MacOSX), which are fully supported, and Windows systems, which are partially supported. Because CairoSVG is only reliably available on Unix systems, Windows installations will not generate Figure 5, but other figures will work. The data generated behind Figure 5, however, is still valid on Windows as well. Unix: python3 -m venv .venv source .venv/bin/activate pip3 install -r requirements.txt Windows (use cmd.exe, not Powershell): python -m venv .venv .venv/Scripts/activate.bat pip install -r requirements.txt Setup the PYTHONPATH variable to point to the current directory. Unix: export PYTHONPATH="." Windows (cmd.exe): set PYTHONPATH=. Note that on MacOSX, you will need to also install cairo, we recommend using Homebrew, and copy the libcairo.2.dylib to the source folder. cp `brew list cairo | grep libcairo.2.dylib` . Generate figures To generate all figures, run python gauss_law/plot/generate_all_figures.py Figure 3. Logical error rates in single round memory experiment python gauss_law/plot/single_round_memory_experiment_analytical.py Figure is in figures/classical_prob_analytical.pdf. Figure 4. UQEC vs GLQEC ratio in single round memory experiment python gauss_law/plot/glqec_vs_uqec_ratio.py Figure 5. Combined memory & simulation plots To create the combined figure based on the existing cached data in the data folder: python gauss_law/plot/combined_memory_and_simulation_plot.py The figure will be in figures/combined_memory_simulation_n8_p8.0e-02.png. Remove and regenerate data WARNING - next steps will remove cached data. Only do this if you want to test regenerating data. To remove cached data, run: rm data/multi_round_* To regenerate the data for both simulation and memory density matrix experiments, run: python gauss_law/plot/multi_round_dm_evolutions.py --simulate --all_theories python gauss_law/plot/multi_round_dm_evolutions.py Figure 6. Monte carlo multi-round samples for memory channel python gauss_law/plot/multi_round_memory_sampling.py Figure 7. Trace distance upper bound plot python gauss_law/plot/memory_slem_upper_bound_plot.py Note that this utility uses the same data that was generated for Figure 5. Figure 8. Lambda2 plot and table of lambda2 values at p=0.08 Using MWPM decoding: python gauss_law/plot/glqec_lambda2_plot.py Figure saved to: figures/glqec_lambda2_plot.pdf Using extended RRW decoding: python gauss_law/plot/glqec_lambda2_plot.py --lookup_table Figure saved to: figures/glqec_lambda2_plot_LUT.pdf Remove and regenerate data for Fig 8. WARNING - next steps will remove cached data. Only do this if you want to test regenerating data. !!! Running the eigenvalue computation is only slightly optimized, on a 10 Apple M4 core Mac mini runs for 2 hours at least for each commands. !!! The commands above use the /cache in the data folder, and you can remove them by running these commands: rm data/glqec_lambd* rm data/glqec_sympy* rm data/lambda2_cache* Then, running the above commands will regenerate the data. Figure 9. Lambda2 based estimators for electric energy python gauss_law/plot/multi_round_memory_sampling.py --num_physical_sites 50 --num_trials 100 --show_upper_bounds --glqec_lambda2 0.924416 Verifying the state counting for the d=3 gauge cause To test up to n=1000, run python gauss_law/state_counting/truncated_u1_counting.py To go higher, pass in the number of sites: python gauss_law/state_counting/truncated_u1_counting.py 2000 Development and running unit tests Install the dev tools by running: pip install -r dev-requirements.txt Then to execute the unit tests, run pytest gauss_law To check coverage, run: pytest --cov=gauss_law gauss_law --cov-config=.coveragerc --cov-report term Should return: =============================================================================================== tests coverage ================================================================================================= _______________________________________________________________________________ coverage: platform darwin, python 3.13.7-final-0 ________________________________________________________________________________ Name Stmts Miss Cover ----------------------------------------------------------------------- gauss_law/channel/core.py 173 17 90% gauss_law/code/rrw.py 49 3 94% gauss_law/code/run_of_ones.py 25 0 100% gauss_law/lattice/array_lattice_operators.py 126 15 88% gauss_law/lattice/protocols.py 23 2 91% gauss_law/lattice/qutip_lattice_operators.py 141 12 91% gauss_law/lattice/staggered_fermion_lattice.py 79 7 91% gauss_law/mixing/lambda2.py 54 40 26% gauss_law/mixing/markov.py 189 38 80% gauss_law/state_counting/truncated_u1_counting.py 84 19 77% ----------------------------------------------------------------------- TOTAL 943 153 84% ============================================================================================= 8172 passed in 46.04s =============================================================================================
Fields of Study & Subjects
Quantum Computing Algorithms and Architecture
Quantum many-body systems
Quantum Information and Cryptography
Publication details
- Journal / source
- Zenodo (CERN European Organization for Nuclear Research)
- Publication date
- 25 February 2026
- Language
- EN