stabrank
Tools for stabilizer-rank bounds on quantum magic states.
stabrank is an open-source Python package with a C++ core for computing, certifying, and formally verifying stabilizer-rank decompositions of quantum magic states.
Built and maintained by the Unitary Foundation.
The library was developed to support the paper Stabilizer-rank bounds for qutrit magic-state orbits and packages the underlying search-and-verify toolchain as a reusable resource. It exposes three independent search modes — a simulated-annealing decomposition search for upper-bound witnesses, an exhaustive k-tuple enumeration over the canonical-form stabilizer-state dictionary for lower-bound certificates, and an enumeration over the symplectic quotient of the two-qutrit Clifford group for injection-gadget existence — and pairs each with a stand-alone verifier so that no result depends on trusting the search heuristic.
What can it do?
- Find stabilizer decompositions of arbitrary qubit and qutrit target states via a multi-chain simulated-annealing engine, with Pauli, Clifford, and single-state perturbation moves and a C++ kernel.
- Certify small-m tight values by exhaustive k-tuple enumeration over the qutrit stabilizer-state dictionary at m = 1, 2, 3 (dictionary sizes 12, 414, 41,580); per-orbit JSON certificates record the witnessing tuple or the minimum-residual non-spanning tuple.
- Verify every closed-form decomposition independently. The seven
qutrit identities are checked at three levels: numerical re-check at
machine precision, exact rational re-check in
SymPy where available, and machine-checked
Lean 4 +
mathlib formalizations under
lean_proofs/. - Search the two-qutrit Clifford group $\mathrm{Cl}(2, 3)$ for injection gadgets via a reduction to the 51,840-element symplectic quotient $\mathrm{Sp}(4, \mathbb F_3)$.
- Diagnose with discrete-Wigner / mana routines and an exhaustive $F_{\max}$ solver tractable at $n \le 4$.
State of the art
Best-known stabilizer-rank values and upper bounds across the qubit and qutrit Clifford-inequivalent magic-state orbits, with citations and provenance, are catalogued on the project page:
Installation
stabrank requires Python 3.12–3.14. Pre-built wheels are published on PyPI for Linux, macOS, and Windows:
pip install stabrank
Or with uv:
uv pip install stabrank
To build from source (e.g.\ for development), clone the repo and install in editable mode; the C++ core is compiled at install time via scikit-build-core and nanobind:
git clone https://github.com/unitaryfoundation/stabrank.git
cd stabrank
uv venv
uv pip install -e .
A working C++ toolchain is required (clang or g++); on macOS the Xcode command-line tools are sufficient.
Quick start
A two-term decomposition of $|\mathbb{S}\rangle^{\otimes 2}$ via the simulated-annealing engine:
import numpy as np
from stabrank.target_functions import qutrit_strange_state
from stabrank.stabrank_core import run_sa_pauli_expansion
target = qutrit_strange_state(2) # 9-dim |S>^2
n, p, chi = 2, 3, 2
initial_basis = [
np.ones(p**n, dtype=complex) / np.sqrt(p**n)
for _ in range(chi)
]
_, basis, coeffs, residual, *_ = run_sa_pauli_expansion(
target=target,
n_orig=n,
p_prime=p,
k_subset_size=chi,
initial_basis=initial_basis,
num_chains=16,
early_exit_threshold=1e-12,
)
print(f"|S>^2 ≈ sum of {chi} stabilizer states, residual = {residual:.2e}")
For more involved workflows — the Norrell $m = 4$ decomposition, the
exhaustive $k$-triple search at $m = 3$, and the gadget existence check
on $\mathrm{Sp}(4, \mathbb F_3)$ — see the public API surface in the
stabrank package and the test suite under tests/.
Citation
If you use stabrank in your work, please cite the arXiv preprint:
@misc{labib2026stabilizer,
title={Stabilizer-rank bounds for qutrit magic-state orbits},
author={Farrokh Labib and Vincent Russo},
year={2026},
eprint={TBA},
archivePrefix={arXiv},
primaryClass={quant-ph},
url={https://arxiv.org/abs/TBA},
}
Funding
This work was supported by the U.S. Department of Energy, Office of Science, Office of Advanced Scientific Computing Research, Accelerated Research in Quantum Computing under Award Number DE-SC0025336.
This material is also based upon work supported by the U.S. Department of Energy, Office of Science, National Quantum Information Science Research Centers, Quantum Science Center.
Development
The test suite runs under pytest. pytest is declared as an
optional test extra (it is not a runtime dependency of the
library), so run it via uv with the extra enabled:
uv run --extra test python -m pytest -q tests
License
Metadata
Release files for stabrank 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| stabrank-0.1.1.tar.gz | 140.7 kB | Details |
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| stabrank-0.1.1-cp314-cp314-win_amd64.whl | CPython 3.14 | CPython 3.14 | Windows x86-64 | Details |
| stabrank-0.1.1-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl | CPython 3.14 | CPython 3.14 | Linux glibc 2.28+ x86-64, Linux glibc 2.27+ x86-64 | Details |
| stabrank-0.1.1-cp314-cp314-macosx_11_0_arm64.whl | CPython 3.14 | CPython 3.14 | macOS 11.0+ ARM64 | Details |
| stabrank-0.1.1-cp313-cp313-win_amd64.whl | CPython 3.13 | CPython 3.13 | Windows x86-64 | Details |
| stabrank-0.1.1-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl | CPython 3.13 | CPython 3.13 | Linux glibc 2.27+ x86-64, Linux glibc 2.28+ x86-64 | Details |
| stabrank-0.1.1-cp313-cp313-macosx_11_0_arm64.whl | CPython 3.13 | CPython 3.13 | macOS 11.0+ ARM64 | Details |
| stabrank-0.1.1-cp312-cp312-win_amd64.whl | CPython 3.12 | CPython 3.12 | Windows x86-64 | Details |
| stabrank-0.1.1-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl | CPython 3.12 | CPython 3.12 | Linux glibc 2.27+ x86-64, Linux glibc 2.28+ x86-64 | Details |
| stabrank-0.1.1-cp312-cp312-macosx_11_0_arm64.whl | CPython 3.12 | CPython 3.12 | macOS 11.0+ ARM64 | Details |
Total release size: 20.1 MB
Release files / stabrank-0.1.1.tar.gz
| Download URL | stabrank-0.1.1.tar.gz |
|---|---|
| Size | 140.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
839cd24b9c42669257d6bef1d46ab0df1723a37201cee742a8b623637cbcf007
|
|
BLAKE2b-256 checksum How to use checksums |
faa923d9ede45956093471df1848904caaf2a152bf216a78df7cd42e4b08f218
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 27, 2026.
Transparency logRelease files / stabrank-0.1.1-cp314-cp314-win_amd64.whl
| Download URL | stabrank-0.1.1-cp314-cp314-win_amd64.whl |
|---|---|
| Size | 2.2 MB |
| Tags | CPython 3.14 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
e72c9915aad63ab655aa9fe94eae5a490f1e121a72d18cdb32ef5a0e22aceac3
|
|
BLAKE2b-256 checksum How to use checksums |
793b95c8cdfde0a792f424977aaebc2d8acf5750bbe70dd128ba2c3392693216
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 27, 2026.
Transparency logRelease files / stabrank-0.1.1-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
| Download URL | stabrank-0.1.1-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 2.3 MB |
| Tags | CPython 3.14 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
4a9c66f7d0ada954a29bfcb37a6dcd5ffbb9aa787e9945c29d8efbbedba02a96
|
|
BLAKE2b-256 checksum How to use checksums |
b3c2ff7c440ccdbe8ede043577d1b5a0dda6af6c7ea5ce71f42ee523f9c61f6e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 27, 2026.
Transparency logRelease files / stabrank-0.1.1-cp314-cp314-macosx_11_0_arm64.whl
| Download URL | stabrank-0.1.1-cp314-cp314-macosx_11_0_arm64.whl |
|---|---|
| Size | 2.2 MB |
| Tags | CPython 3.14 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
37be5f2e149766e5460fc5e67b243a305cfe9d516cfeb8113f530b17cdd55e4e
|
|
BLAKE2b-256 checksum How to use checksums |
9268812e7fb3132c4616131e34c457057d537c1161c6427c6916066ade20c81f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 27, 2026.
Transparency logRelease files / stabrank-0.1.1-cp313-cp313-win_amd64.whl
| Download URL | stabrank-0.1.1-cp313-cp313-win_amd64.whl |
|---|---|
| Size | 2.2 MB |
| Tags | CPython 3.13 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
196252abf516b41704f3691c08e53670989179e419e63a3a207aa724d5613d35
|
|
BLAKE2b-256 checksum How to use checksums |
61e05036b45d640989e4984fdd682377ba30020cb0756ca909f7cef501ef0109
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 27, 2026.
Transparency logRelease files / stabrank-0.1.1-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
| Download URL | stabrank-0.1.1-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 2.3 MB |
| Tags | CPython 3.13 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
2e3485bc035e04eb2546fa400b4e41300b82f8ef41505cce6af82c4ecad3cca9
|
|
BLAKE2b-256 checksum How to use checksums |
cd4e93fbd0f2d852abeb3223f10322eb18ea6bbe5516ee0243bb24106a19317b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 27, 2026.
Transparency logRelease files / stabrank-0.1.1-cp313-cp313-macosx_11_0_arm64.whl
| Download URL | stabrank-0.1.1-cp313-cp313-macosx_11_0_arm64.whl |
|---|---|
| Size | 2.2 MB |
| Tags | CPython 3.13 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
240b2c2484708d7fa82437221d0d660011dbde5458ccd26422a34e66f5550089
|
|
BLAKE2b-256 checksum How to use checksums |
f2a95789cce56b73a7449709cd9ff6ccca3cd95ab36229ceb3b32d2aa15aca97
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 27, 2026.
Transparency logRelease files / stabrank-0.1.1-cp312-cp312-win_amd64.whl
| Download URL | stabrank-0.1.1-cp312-cp312-win_amd64.whl |
|---|---|
| Size | 2.2 MB |
| Tags | CPython 3.12 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
bc6a903138d60ba78a256bb8e842223331a83646b3a1d0dab4a140eb491b2582
|
|
BLAKE2b-256 checksum How to use checksums |
715b5f8fac3adcb5b1f03d634d1903695fe2f86c7585a3f3a7c3c0cd3ca53e4d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 27, 2026.
Transparency logRelease files / stabrank-0.1.1-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
| Download URL | stabrank-0.1.1-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 2.3 MB |
| Tags | CPython 3.12 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
cb7485a32b61fe0b4309e06fc424a91583ca3808ceb1bc1ce7773c00f83a190a
|
|
BLAKE2b-256 checksum How to use checksums |
64255026bd1712c3cde400fdc96d75011e45e1adf1da668e2019c7161e489047
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 27, 2026.
Transparency logRelease files / stabrank-0.1.1-cp312-cp312-macosx_11_0_arm64.whl
| Download URL | stabrank-0.1.1-cp312-cp312-macosx_11_0_arm64.whl |
|---|---|
| Size | 2.2 MB |
| Tags | CPython 3.12 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
6594f185bc6b1b63531d3a7fd93fb9527b16f1d5c84364e341049488b317a6bc
|
|
BLAKE2b-256 checksum How to use checksums |
5646d3ef851188b565bb85a70e8d506d48a2c8fb408ea9b13efabdba1479b5d2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 27, 2026.
Transparency log