Tools for stabilizer-rank bounds on quantum magic states.
Project description
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file stabrank-0.1.1.tar.gz.
File metadata
- Download URL: stabrank-0.1.1.tar.gz
- Upload date:
- Size: 140.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
839cd24b9c42669257d6bef1d46ab0df1723a37201cee742a8b623637cbcf007
|
|
| MD5 |
082d8a7e435ae17061b7c654475fa3c1
|
|
| BLAKE2b-256 |
faa923d9ede45956093471df1848904caaf2a152bf216a78df7cd42e4b08f218
|
Provenance
The following attestation bundles were made for stabrank-0.1.1.tar.gz:
Publisher:
publish.yml on unitaryfoundation/stabrank
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
stabrank-0.1.1.tar.gz -
Subject digest:
839cd24b9c42669257d6bef1d46ab0df1723a37201cee742a8b623637cbcf007 - Sigstore transparency entry: 1643082535
- Sigstore integration time:
-
Permalink:
unitaryfoundation/stabrank@a28d311c203288e0f30ed994900d872fc80ef700 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/unitaryfoundation
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@a28d311c203288e0f30ed994900d872fc80ef700 -
Trigger Event:
push
-
Statement type:
File details
Details for the file stabrank-0.1.1-cp314-cp314-win_amd64.whl.
File metadata
- Download URL: stabrank-0.1.1-cp314-cp314-win_amd64.whl
- Upload date:
- Size: 2.2 MB
- Tags: CPython 3.14, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e72c9915aad63ab655aa9fe94eae5a490f1e121a72d18cdb32ef5a0e22aceac3
|
|
| MD5 |
526edc9addfe456946d79aa666d427de
|
|
| BLAKE2b-256 |
793b95c8cdfde0a792f424977aaebc2d8acf5750bbe70dd128ba2c3392693216
|
Provenance
The following attestation bundles were made for stabrank-0.1.1-cp314-cp314-win_amd64.whl:
Publisher:
publish.yml on unitaryfoundation/stabrank
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
stabrank-0.1.1-cp314-cp314-win_amd64.whl -
Subject digest:
e72c9915aad63ab655aa9fe94eae5a490f1e121a72d18cdb32ef5a0e22aceac3 - Sigstore transparency entry: 1643083125
- Sigstore integration time:
-
Permalink:
unitaryfoundation/stabrank@a28d311c203288e0f30ed994900d872fc80ef700 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/unitaryfoundation
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@a28d311c203288e0f30ed994900d872fc80ef700 -
Trigger Event:
push
-
Statement type:
File details
Details for the file stabrank-0.1.1-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.
File metadata
- Download URL: stabrank-0.1.1-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
- Upload date:
- Size: 2.3 MB
- Tags: CPython 3.14, manylinux: glibc 2.27+ x86-64, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4a9c66f7d0ada954a29bfcb37a6dcd5ffbb9aa787e9945c29d8efbbedba02a96
|
|
| MD5 |
090dea68c5c81c34c4d5e6ad5d881432
|
|
| BLAKE2b-256 |
b3c2ff7c440ccdbe8ede043577d1b5a0dda6af6c7ea5ce71f42ee523f9c61f6e
|
Provenance
The following attestation bundles were made for stabrank-0.1.1-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:
Publisher:
publish.yml on unitaryfoundation/stabrank
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
stabrank-0.1.1-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl -
Subject digest:
4a9c66f7d0ada954a29bfcb37a6dcd5ffbb9aa787e9945c29d8efbbedba02a96 - Sigstore transparency entry: 1643082905
- Sigstore integration time:
-
Permalink:
unitaryfoundation/stabrank@a28d311c203288e0f30ed994900d872fc80ef700 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/unitaryfoundation
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@a28d311c203288e0f30ed994900d872fc80ef700 -
Trigger Event:
push
-
Statement type:
File details
Details for the file stabrank-0.1.1-cp314-cp314-macosx_11_0_arm64.whl.
File metadata
- Download URL: stabrank-0.1.1-cp314-cp314-macosx_11_0_arm64.whl
- Upload date:
- Size: 2.2 MB
- Tags: CPython 3.14, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
37be5f2e149766e5460fc5e67b243a305cfe9d516cfeb8113f530b17cdd55e4e
|
|
| MD5 |
eed212513d353c50f946f19607553a3b
|
|
| BLAKE2b-256 |
9268812e7fb3132c4616131e34c457057d537c1161c6427c6916066ade20c81f
|
Provenance
The following attestation bundles were made for stabrank-0.1.1-cp314-cp314-macosx_11_0_arm64.whl:
Publisher:
publish.yml on unitaryfoundation/stabrank
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
stabrank-0.1.1-cp314-cp314-macosx_11_0_arm64.whl -
Subject digest:
37be5f2e149766e5460fc5e67b243a305cfe9d516cfeb8113f530b17cdd55e4e - Sigstore transparency entry: 1643083033
- Sigstore integration time:
-
Permalink:
unitaryfoundation/stabrank@a28d311c203288e0f30ed994900d872fc80ef700 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/unitaryfoundation
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@a28d311c203288e0f30ed994900d872fc80ef700 -
Trigger Event:
push
-
Statement type:
File details
Details for the file stabrank-0.1.1-cp313-cp313-win_amd64.whl.
File metadata
- Download URL: stabrank-0.1.1-cp313-cp313-win_amd64.whl
- Upload date:
- Size: 2.2 MB
- Tags: CPython 3.13, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
196252abf516b41704f3691c08e53670989179e419e63a3a207aa724d5613d35
|
|
| MD5 |
841727c19ddf22d178f6400557307ec1
|
|
| BLAKE2b-256 |
61e05036b45d640989e4984fdd682377ba30020cb0756ca909f7cef501ef0109
|
Provenance
The following attestation bundles were made for stabrank-0.1.1-cp313-cp313-win_amd64.whl:
Publisher:
publish.yml on unitaryfoundation/stabrank
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
stabrank-0.1.1-cp313-cp313-win_amd64.whl -
Subject digest:
196252abf516b41704f3691c08e53670989179e419e63a3a207aa724d5613d35 - Sigstore transparency entry: 1643082814
- Sigstore integration time:
-
Permalink:
unitaryfoundation/stabrank@a28d311c203288e0f30ed994900d872fc80ef700 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/unitaryfoundation
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@a28d311c203288e0f30ed994900d872fc80ef700 -
Trigger Event:
push
-
Statement type:
File details
Details for the file stabrank-0.1.1-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.
File metadata
- Download URL: stabrank-0.1.1-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
- Upload date:
- Size: 2.3 MB
- Tags: CPython 3.13, manylinux: glibc 2.27+ x86-64, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2e3485bc035e04eb2546fa400b4e41300b82f8ef41505cce6af82c4ecad3cca9
|
|
| MD5 |
a6f649cbb730aa1e95584ca03b0defcc
|
|
| BLAKE2b-256 |
cd4e93fbd0f2d852abeb3223f10322eb18ea6bbe5516ee0243bb24106a19317b
|
Provenance
The following attestation bundles were made for stabrank-0.1.1-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:
Publisher:
publish.yml on unitaryfoundation/stabrank
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
stabrank-0.1.1-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl -
Subject digest:
2e3485bc035e04eb2546fa400b4e41300b82f8ef41505cce6af82c4ecad3cca9 - Sigstore transparency entry: 1643082605
- Sigstore integration time:
-
Permalink:
unitaryfoundation/stabrank@a28d311c203288e0f30ed994900d872fc80ef700 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/unitaryfoundation
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@a28d311c203288e0f30ed994900d872fc80ef700 -
Trigger Event:
push
-
Statement type:
File details
Details for the file stabrank-0.1.1-cp313-cp313-macosx_11_0_arm64.whl.
File metadata
- Download URL: stabrank-0.1.1-cp313-cp313-macosx_11_0_arm64.whl
- Upload date:
- Size: 2.2 MB
- Tags: CPython 3.13, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
240b2c2484708d7fa82437221d0d660011dbde5458ccd26422a34e66f5550089
|
|
| MD5 |
1b62ad2331419303e3449af3a14b428c
|
|
| BLAKE2b-256 |
f2a95789cce56b73a7449709cd9ff6ccca3cd95ab36229ceb3b32d2aa15aca97
|
Provenance
The following attestation bundles were made for stabrank-0.1.1-cp313-cp313-macosx_11_0_arm64.whl:
Publisher:
publish.yml on unitaryfoundation/stabrank
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
stabrank-0.1.1-cp313-cp313-macosx_11_0_arm64.whl -
Subject digest:
240b2c2484708d7fa82437221d0d660011dbde5458ccd26422a34e66f5550089 - Sigstore transparency entry: 1643082722
- Sigstore integration time:
-
Permalink:
unitaryfoundation/stabrank@a28d311c203288e0f30ed994900d872fc80ef700 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/unitaryfoundation
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@a28d311c203288e0f30ed994900d872fc80ef700 -
Trigger Event:
push
-
Statement type:
File details
Details for the file stabrank-0.1.1-cp312-cp312-win_amd64.whl.
File metadata
- Download URL: stabrank-0.1.1-cp312-cp312-win_amd64.whl
- Upload date:
- Size: 2.2 MB
- Tags: CPython 3.12, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bc6a903138d60ba78a256bb8e842223331a83646b3a1d0dab4a140eb491b2582
|
|
| MD5 |
3fe746a72dd53324b084946b1826b95f
|
|
| BLAKE2b-256 |
715b5f8fac3adcb5b1f03d634d1903695fe2f86c7585a3f3a7c3c0cd3ca53e4d
|
Provenance
The following attestation bundles were made for stabrank-0.1.1-cp312-cp312-win_amd64.whl:
Publisher:
publish.yml on unitaryfoundation/stabrank
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
stabrank-0.1.1-cp312-cp312-win_amd64.whl -
Subject digest:
bc6a903138d60ba78a256bb8e842223331a83646b3a1d0dab4a140eb491b2582 - Sigstore transparency entry: 1643083067
- Sigstore integration time:
-
Permalink:
unitaryfoundation/stabrank@a28d311c203288e0f30ed994900d872fc80ef700 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/unitaryfoundation
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@a28d311c203288e0f30ed994900d872fc80ef700 -
Trigger Event:
push
-
Statement type:
File details
Details for the file stabrank-0.1.1-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.
File metadata
- Download URL: stabrank-0.1.1-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
- Upload date:
- Size: 2.3 MB
- Tags: CPython 3.12, manylinux: glibc 2.27+ x86-64, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cb7485a32b61fe0b4309e06fc424a91583ca3808ceb1bc1ce7773c00f83a190a
|
|
| MD5 |
fdaf2eae0d2ec48d3a7ca0f2779c53d3
|
|
| BLAKE2b-256 |
64255026bd1712c3cde400fdc96d75011e45e1adf1da668e2019c7161e489047
|
Provenance
The following attestation bundles were made for stabrank-0.1.1-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:
Publisher:
publish.yml on unitaryfoundation/stabrank
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
stabrank-0.1.1-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl -
Subject digest:
cb7485a32b61fe0b4309e06fc424a91583ca3808ceb1bc1ce7773c00f83a190a - Sigstore transparency entry: 1643082982
- Sigstore integration time:
-
Permalink:
unitaryfoundation/stabrank@a28d311c203288e0f30ed994900d872fc80ef700 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/unitaryfoundation
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@a28d311c203288e0f30ed994900d872fc80ef700 -
Trigger Event:
push
-
Statement type:
File details
Details for the file stabrank-0.1.1-cp312-cp312-macosx_11_0_arm64.whl.
File metadata
- Download URL: stabrank-0.1.1-cp312-cp312-macosx_11_0_arm64.whl
- Upload date:
- Size: 2.2 MB
- Tags: CPython 3.12, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6594f185bc6b1b63531d3a7fd93fb9527b16f1d5c84364e341049488b317a6bc
|
|
| MD5 |
21578ece886ed0a87e16e4256fa882e1
|
|
| BLAKE2b-256 |
5646d3ef851188b565bb85a70e8d506d48a2c8fb408ea9b13efabdba1479b5d2
|
Provenance
The following attestation bundles were made for stabrank-0.1.1-cp312-cp312-macosx_11_0_arm64.whl:
Publisher:
publish.yml on unitaryfoundation/stabrank
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
stabrank-0.1.1-cp312-cp312-macosx_11_0_arm64.whl -
Subject digest:
6594f185bc6b1b63531d3a7fd93fb9527b16f1d5c84364e341049488b317a6bc - Sigstore transparency entry: 1643083100
- Sigstore integration time:
-
Permalink:
unitaryfoundation/stabrank@a28d311c203288e0f30ed994900d872fc80ef700 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/unitaryfoundation
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@a28d311c203288e0f30ed994900d872fc80ef700 -
Trigger Event:
push
-
Statement type: