Skip to main content

Tools for stabilizer-rank bounds on quantum magic states.

Project description

stabrank

stabrank

Tools for stabilizer-rank bounds on quantum magic states.

Unitary Foundation CI License

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:

https://unitaryfoundation.github.io/stabrank/#soa

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

Apache-2.0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

stabrank-0.1.0.tar.gz (140.7 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

stabrank-0.1.0-cp314-cp314-win_amd64.whl (2.2 MB view details)

Uploaded CPython 3.14Windows x86-64

stabrank-0.1.0-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (2.3 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

stabrank-0.1.0-cp314-cp314-macosx_11_0_arm64.whl (2.2 MB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

stabrank-0.1.0-cp313-cp313-win_amd64.whl (2.2 MB view details)

Uploaded CPython 3.13Windows x86-64

stabrank-0.1.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (2.3 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

stabrank-0.1.0-cp313-cp313-macosx_11_0_arm64.whl (2.2 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

stabrank-0.1.0-cp312-cp312-win_amd64.whl (2.2 MB view details)

Uploaded CPython 3.12Windows x86-64

stabrank-0.1.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (2.3 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

stabrank-0.1.0-cp312-cp312-macosx_11_0_arm64.whl (2.2 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

File details

Details for the file stabrank-0.1.0.tar.gz.

File metadata

  • Download URL: stabrank-0.1.0.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

Hashes for stabrank-0.1.0.tar.gz
Algorithm Hash digest
SHA256 6a3a35c3ceb93defef9c36432761e8d1d8392e08c2809943ab00b838f76d9b38
MD5 60b3a92ec4feef5ebc3aaa71b43f1138
BLAKE2b-256 b57179c3ef7573d3d9b2a7b7daa90862196e2dfd7989cfbf307549f7161f598b

See more details on using hashes here.

Provenance

The following attestation bundles were made for stabrank-0.1.0.tar.gz:

Publisher: publish.yml on unitaryfoundation/stabrank

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file stabrank-0.1.0-cp314-cp314-win_amd64.whl.

File metadata

  • Download URL: stabrank-0.1.0-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

Hashes for stabrank-0.1.0-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 cf443f6d7c2e9ed9caa38280e027835a98564332a946e7166d740290e617620d
MD5 ad18da660f98f1581fffe9d9167f702b
BLAKE2b-256 7b451393481c2f61cdb8e3f606fb71f1b6eafaf39990db734ceca54277975efe

See more details on using hashes here.

Provenance

The following attestation bundles were made for stabrank-0.1.0-cp314-cp314-win_amd64.whl:

Publisher: publish.yml on unitaryfoundation/stabrank

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file stabrank-0.1.0-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for stabrank-0.1.0-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 a00ff8b22c1da58607484ec8ac4f2f4533f9c2196593a33de0fc23ddcb571457
MD5 61ece45672d00a37cc9daca2f9497edb
BLAKE2b-256 9a61ec625911d60766990cc3686c11c8608a892961e40a53ba2f739d636d3cfb

See more details on using hashes here.

Provenance

The following attestation bundles were made for stabrank-0.1.0-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: publish.yml on unitaryfoundation/stabrank

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file stabrank-0.1.0-cp314-cp314-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for stabrank-0.1.0-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 485fd198af0d5d22bdaed3b2819513111b8ea757e7178850b3e9d63f0f3292a3
MD5 e183eeb59e218c07d3c9e27ab1029675
BLAKE2b-256 b9aa6f207b881a421966e72382294b2cfb9dd2851e525a19c07c9adac92bb570

See more details on using hashes here.

Provenance

The following attestation bundles were made for stabrank-0.1.0-cp314-cp314-macosx_11_0_arm64.whl:

Publisher: publish.yml on unitaryfoundation/stabrank

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file stabrank-0.1.0-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: stabrank-0.1.0-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

Hashes for stabrank-0.1.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 c96cd290b97dc7499840571fbfb9fef15d5367d1b47f1153c8d4fc4c2f7cd89b
MD5 66832685515bf5a0270e821bd09f6aed
BLAKE2b-256 0f31a54bf54a6b1d63efba79e53a255777e82cb21fc924108fa75c4d4c165d63

See more details on using hashes here.

Provenance

The following attestation bundles were made for stabrank-0.1.0-cp313-cp313-win_amd64.whl:

Publisher: publish.yml on unitaryfoundation/stabrank

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file stabrank-0.1.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for stabrank-0.1.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 921d8c25b9a7060aee2e2277c4c37b3ff2eccd69b3ecda42674a6ea0cfca5780
MD5 61d3e8fe9aebc28e5ce7b7514f336dc1
BLAKE2b-256 937b1343d529ba014f63a380c03c299d5cb88230530e292feda526bb32f6e02b

See more details on using hashes here.

Provenance

The following attestation bundles were made for stabrank-0.1.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: publish.yml on unitaryfoundation/stabrank

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file stabrank-0.1.0-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for stabrank-0.1.0-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8afc75ed5bcafb25c5ddee3af73e6598a2a30398d008aec632bac8ff838b4545
MD5 22636fb99644d4d9ef16859d1490ed05
BLAKE2b-256 8585d97ed753bbf97ff874c424634e8a69cb968e26594a25f931ddd1ce76f4d0

See more details on using hashes here.

Provenance

The following attestation bundles were made for stabrank-0.1.0-cp313-cp313-macosx_11_0_arm64.whl:

Publisher: publish.yml on unitaryfoundation/stabrank

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file stabrank-0.1.0-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: stabrank-0.1.0-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

Hashes for stabrank-0.1.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 a75c62936c1a7175dbf310397d9a9561557e6b4d51bddb708f1207801c5146fa
MD5 baf60b95ee1c83a076bfae72b1c84868
BLAKE2b-256 13a6e133499906a2f9d5f8205c520f0b569b07455d0c1bc1f950d4b9c75a13a0

See more details on using hashes here.

Provenance

The following attestation bundles were made for stabrank-0.1.0-cp312-cp312-win_amd64.whl:

Publisher: publish.yml on unitaryfoundation/stabrank

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file stabrank-0.1.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for stabrank-0.1.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 911a18e2e7b652302ff59bf9d87bb29d722a88a4ee8e36f78cf9d9efc818be18
MD5 4f6fd3971bce8142192ac99756ce3875
BLAKE2b-256 696764aac318a1803846c2ea751c3cbc8813683e84cf1a1b45ec19c230fe4b36

See more details on using hashes here.

Provenance

The following attestation bundles were made for stabrank-0.1.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: publish.yml on unitaryfoundation/stabrank

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file stabrank-0.1.0-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for stabrank-0.1.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 067377f1c7c3a5b7601f878c9f6e18dbf4e7c0be0160d7d4407ea5b68c2c0398
MD5 045eac07f829cc10546eee96e35d782a
BLAKE2b-256 68bb114151d93541c6ee18e9dee4d6ac614126da80c1348b0dce9d729d831432

See more details on using hashes here.

Provenance

The following attestation bundles were made for stabrank-0.1.0-cp312-cp312-macosx_11_0_arm64.whl:

Publisher: publish.yml on unitaryfoundation/stabrank

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page