This repository accompanies the paper
- A. BΓ€rligea et al., "Enabling Lie Algebraic Classical Simulation beyond Free Fermions" β https://arxiv.org/abs/2604.16701
and builds on the Lie-algebraic simulation framework of
- M. L. Goh et al., βLie-algebraic classical simulations for quantum computingβ β https://doi.org/10.1103/3y65-f5w6
The goal of this repository is twofold:
- to provide the code used to reproduce the numerical experiments of the accompanying paper, and
- to expose the optimized basis-specific preprocessing primitives that underlie these simulations.
At its current stage, the repository contains a high-performance implementation of several symmetry-adapted preprocessing backends, together with experiment-specific scripts and tutorials showing how to turn them into full
The core idea of
This repository currently contains optimized preprocessing backends for four basis types:
- Pauli strings
- (translational-invariant) Pauli cycles
- (permutation-invariant) Pauli orbits
- the MGGM basis for fixed-Hamming-weight sectors
These primitives are then used in the experiment scripts in examples/ to build complete simulation pipelines for the numerical case studies in the paper.
g-sim/
βββ examples/
β βββ data/
β β βββ adj_gcycles_TFIM_n50.npz
β β βββ adj_gmggm_k2_n10.npz
β β βββ adj_gorbits_targeted_n50.npz
β β βββ adj_gstrings_TFIM_n50.npz
β βββ hwencoder_demonstration.ipynb
β βββ hwencoder_helpers.py
β βββ hwencoder_simulator.py
β βββ peqnn_demonstration.ipynb
β βββ peqnn_helpers.py
β βββ peqnn_simulator.py
β βββ tfim_demonstration.ipynb
β βββ tfim_helpers.py
β βββ tfim_simulator.py
βββ src/
β βββ gsim/
β βββ __init__.py
β βββ gcycles.py
β βββ gmggm.py
β βββ gorbits.py
β βββ gstrings.py
β βββ utils.py
βββ pyproject.toml
βββ README.md
The actual Python package lives in src/gsim. It contains the low-level preprocessing routines used to construct Lie bases and sparse commutator / generator data in different symmetry-adapted representations.
Pauli-string preprocessing.
This module provides Lie closure and preprocessing routines when generators are given explicitly as Pauli strings or as sums of Pauli strings. It is the most direct backend and is used in the free-fermionic TFIM example.
Pauli-cycle preprocessing for Translation-invariant systems.
This backend supports one-dimensional translational settings, including both periodic and open boundary conditions. Internally, it distinguishes canonical cyclic representatives from open-boundary bulk/fixed decompositions.
Pauli-orbit preprocessing for permutation-invariant systems.
This module implements preprocessing in the orbit basis labeled by triples ((p,q,r)), counting the number of (X), (Y), and (Z) factors in an orbit. It supports both full structure-constant computation and targeted construction of generator matrices for selected orbit generators.
MGGM preprocessing for fixed-Hamming-weight sectors.
This module provides backends for simulations restricted to the fixed-Hamming-weight subspace (\mathcal H_k). It includes both full preprocessing and a targeted implementation specialized to the antisymmetric generators relevant for RBS-based state-preparation circuits.
Shared utilities.
This file contains helper routines used across the package, including loading / saving sparse preprocessing data and basis-related helpers.
The examples/ directory contains the code corresponding to the numerical experiments in the paper. These scripts are intentionally problem-specific: they illustrate how the basis primitives in src/gsim can be assembled into complete simulation workflows for concrete structured quantum circuits.
At present, the examples are not meant to be a polished general API. Instead, they are included to make the numerical section of the paper directly reproducible and to serve as worked tutorials for constructing
Free-fermionic TFIM / TFIM-HVA example based on Pauli-string preprocessing.
These files show how to:
- construct the relevant Pauli-string generators,
- build or load the corresponding adjoint block data,
- evaluate TFIM expectation values and gradients efficiently in adjoint space,
- compare against a direct circuit simulator in the accompanying notebook.
Permutation-equivariant QNN example for graph-state classification.
These files show how to:
- construct the Pauli-orbit representation of graph-state inputs,
- build the permutation-invariant loss function,
- evaluate the loss and its gradients via targeted orbit-generator matrices,
- validate the implementation against a direct reference simulation.
Fixed-Hamming-weight amplitude encoding example.
These files implement the HW-preserving encoder used in the paperβs state-preparation experiment. They demonstrate how to:
- construct the Chase ordering of fixed-Hamming-weight basis states,
- map controlled RBS gates to MGGM generators,
- simulate the encoding entirely in the MGGM basis,
- compare the encoded distribution to the target distribution in the notebook tutorial.
This folder contains precomputed sparse preprocessing data used by some of the examples, such as targeted generator matrices or adjoint block decompositions. These files are included to make the demonstrations easier to run and to avoid repeating expensive preprocessing when reproducing the experiments.
git clone https://github.com/adelina-b/g-sim.git
cd g-simpython -m pip install -r requirements.txt
python -m pip install -e .After this, the package can be imported as
import gsimor, for example,
from gsim import gstrings, gorbits, gmggm, gcyclesFor Pauli-string preprocessing in the symplectic representation, the current implementation depends on PauliEngine.
Please install PauliEngine separately by following its installation instructions:
[https://github.com/tequilahub/pauliengine]
At the moment, users have to rebuild PauliEngine for their own system and Python version.
This is a temporary limitation of the current development state; a cleaner installation route is planned for future releases.
The easiest way to get started is to open one of the demonstration notebooks in examples/:
examples/tfim_demonstration.ipynbexamples/peqnn_demonstration.ipynbexamples/hwencoder_demonstration.ipynb
These notebooks are meant to be instructive entry points. They explain the relevant simulation task, show how the preprocessing data are used, and compare the
This repository is under active development.
What is already included:
- optimized basis-specific preprocessing routines,
- the code needed to reproduce the numerical experiments of the accompanying paper,
- experiment notebooks demonstrating the use of the implemented primitives.
What is still in progress:
- a more unified end-to-end
$\mathfrak{g}$ -sim interface, - broader support for reusable high-level simulator APIs,
- cleaner installation of dependencies,
- improved serialization and loading of preprocessing data,
- more general and better documented workflows beyond the paper-specific examples.
In other words, the present repository should be viewed as:
- a reproducibility repository for the paper, and
- an intermediate public release of the core preprocessing technology,
rather than the final form of the software framework.
The numerical examples reported in the paper are implemented in the examples/ directory. The corresponding scripts and notebooks demonstrate the three main case studies:
- free-fermionic TFIM dynamics,
- permutation-equivariant quantum graph classification,
- fixed-Hamming-weight amplitude encoding.
Because these workflows are currently tailored to the specific experiments in the manuscript, some paths, parameterizations, and preprocessing assumptions are intentionally specialized. They nevertheless provide fully worked examples of how the underlying basis primitives are used in practice.
If you use this repository, please cite:
@misc{Barligea2026},
title={Enabling Lie-Algebraic Classical Simulation beyond Free Fermions},
author={Adelina BΓ€rligea and Matthew L. Sims-Goh and Jakob S. Kottmann},
year={2026},
eprint={2604.16701},
archivePrefix={arXiv},
primaryClass={quant-ph},
url={https://arxiv.org/abs/2604.16701},
}and, where appropriate, also cite the original
@article{Goh2025,
title = {Lie-algebraic classical simulations for quantum computing},
volume = {7},
ISSN = {2643-1564},
url = {http://dx.doi.org/10.1103/3y65-f5w6},
DOI = {10.1103/3y65-f5w6},
number = {3},
journal = {Physical Review Research},
publisher = {American Physical Society (APS)},
author = {Goh, Matthew L. and Larocca, Martin and Cincio, Lukasz and Cerezo, M. and Sauvage, FrΓ©dΓ©ric},
year = {2025},
month = sept
}This repository is released under the MIT License. See the LICENSE file for the full license text.