PRISM-Q for Python
A quantum circuit simulator with a Rust core. PRISM-Q reads the structure of each circuit and picks how to store its state: a stabilizer tableau for Clifford circuits, a dense statevector for general ones, and a sparse map, matrix product state, product state or factored form where the circuit allows. The result reports which one ran.
- Source, issues and discussions: https://github.com/AbeCoull/prism-q
- Documentation: https://abecoull.github.io/prism-q/
Install
pip install prism-q
Wheels cover CPython 3.11 and newer on Linux (x86_64, aarch64), macOS (arm64) and Windows (x64). Other platforms build from the source distribution, which needs a Rust toolchain.
Quick start
import prism_q
# Exact probabilities of a Bell state.
bell = prism_q.CircuitBuilder(2).h(0).cx(0, 1).build()
print(prism_q.simulate(bell).seed(42).run().probabilities) # [0.5 0. 0. 0.5]
# Parse OpenQASM and sample shots. Counts are sampled, so they move with the seed.
qasm = """
OPENQASM 3.0;
qubit[2] q;
bit[2] c;
h q[0];
cx q[0], q[1];
c = measure q;
"""
result = prism_q.simulate(prism_q.parse_qasm(qasm)).seed(42).shots(1000)
print(result.counts()) # {'11': 493, '00': 507}
# The exact statevector as a NumPy array.
sv = prism_q.simulate(prism_q.circuits.ghz(3)).seed(42).state_vector()
print(sv.dtype, sv.shape) # complex128 (8,)
Why the backend choice matters
from prism_q import CircuitBuilder, circuits, simulate
def backend(circuit):
return simulate(circuit).seed(42).run().metadata.backend
print(backend(circuits.qft(16))) # Statevector
print(backend(circuits.ghz(1000))) # Stabilizer
ghz_t = CircuitBuilder(60).h(0)
for q in range(59):
ghz_t.cx(q, q + 1)
print(backend(ghz_t.t(0).build())) # Sparse
A 1,000-qubit GHZ circuit is all Clifford gates, so a stabilizer tableau holds it. Add
one T gate to a 60-qubit GHZ circuit and the tableau no longer applies, but only two of
its 2^60 basis states are ever nonzero, so a sparse map does. The selection follows
structural rules and the host's memory, not timed trials, so naming a backend with
.backend(prism_q.BackendKind.statevector()) and its siblings can beat it on a circuit
the rules misjudge. metadata.reason says which rule fired.
What the package covers
CircuitBuilder, OpenQASM 3.0 parsing and export (Circuit.to_qasm), and text, SVG and Jupyter circuit drawing.- Classical control on measured bits (
ClassicalCondition,guardedwith an else branch) and measurement in a Pauli basis or of a Pauli product. - Circuit generators in
prism_q.circuits: QFT, GHZ, QAOA, hardware-efficient ansatz, quantum volume and more. - Parameter sweeps without a rebuild (
Parameters,PreparedCircuit) and adjoint gradients. - Noise models (
NoiseModel,NoiseChannel, two-qubit Kraus channels included) for shot sampling. - Compiled Clifford samplers (
CompiledSampler) with streamed marginals, parities and correlators, plus analytic noisy marginals (noisy_marginals_analytical). - QEC programs (
QecProgram) with detector and observable sampling and feed-forward corrections. - NumPy output for probabilities, statevectors and QEC bit matrices, and pickling for
circuits, parameters, noise models and QEC programs, so they cross
multiprocessing, Ray and Dask boundaries.
GPU
The Linux and Windows wheels include the CUDA backends; the macOS wheel does not. Nothing
CUDA-related loads at import, so the package runs on the CPU on any machine. A GPU run
needs an NVIDIA device with a CUDA 12 driver, installed through the system, and NVRTC,
which the cuda12 extra installs from PyPI:
pip install "prism-q[cuda12]"
Without a driver or NVRTC, only GpuContext(...) raises. prism_q.gpu_info() reports
the device, or why it cannot be used. MPI-distributed execution is a Rust feature and is
not in the wheels.
Bit ordering
Count keys and measurement bit indices are LSB-first: in a bitstring key the leftmost
character is classical bit 0, and q[0] is the least significant qubit of a statevector
index. This is the reverse of Qiskit. Measuring q[i] into c[i], the state where only
q[0] is set reads as "10...", not "...01".
Documentation
- Python guide
- Tutorials and example scripts
- Choosing a backend
- Capability matrix, for what runs where and what is experimental
- Benchmarks and the method behind them
- Changelog
Contributing
Bug reports, questions and pull requests are welcome on GitHub. If the package is useful in your work, a star on the repository helps other people find it.
License
MIT OR Apache-2.0
Metadata
Release files for prism-q 0.37.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| prism_q-0.37.0.tar.gz | 2.4 MB | With provenance | Details for prism_q-0.37.0.tar.gz |
Built distributions (wheels)
| File | Actions Reset | |||
|---|---|---|---|---|
| prism_q-0.37.0-cp311-abi3-win_amd64.whl | CPython 3.11 | abi3 | Windows x86-64 | Details for prism_q-0.37.0-cp311-abi3-win_amd64.whl |
| prism_q-0.37.0-cp311-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl | CPython 3.11 | abi3 | Linux glibc 2.17+ x86-64 | Details for prism_q-0.37.0-cp311-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl |
| prism_q-0.37.0-cp311-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl | CPython 3.11 | abi3 | Linux glibc 2.17+ ARM64 | Details for prism_q-0.37.0-cp311-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl |
| prism_q-0.37.0-cp311-abi3-macosx_11_0_arm64.whl | CPython 3.11 | abi3 | macOS 11.0+ ARM64 | Details for prism_q-0.37.0-cp311-abi3-macosx_11_0_arm64.whl |
Total release size: 19.3 MB
Release files / prism_q-0.37.0.tar.gz
| Download URL | prism_q-0.37.0.tar.gz |
|---|---|
| Size | 2.4 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
709226544a87a6864e5cee3a6afc875f842936c5809a9c31fa142d974b19d779
|
|
BLAKE2b-256 checksum How to use checksums |
541fe899e558e0abf62a00b0bc2f6317f4358715c52d9c497c6e6f69a5696682
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Nov 2, 2026.
Transparency logRelease files / prism_q-0.37.0-cp311-abi3-win_amd64.whl
| Download URL | prism_q-0.37.0-cp311-abi3-win_amd64.whl |
|---|---|
| Size | 4.9 MB |
| Tags | CPython 3.11 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
715e0dd8c32ccc142675bd614a86b9992397fe6a477a9d61ed3cbf32a5d89b32
|
|
BLAKE2b-256 checksum How to use checksums |
b3ce719191feb355cc24aa242b4adb2dedbc38c8b56c66c093ed978f2833c366
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Nov 2, 2026.
Transparency logRelease files / prism_q-0.37.0-cp311-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
| Download URL | prism_q-0.37.0-cp311-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl |
|---|---|
| Size | 4.6 MB |
| Tags | CPython 3.11 Linux glibc 2.17+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
9d5098bf2067ddf1b4cb88569c6c02a3f29e6d39bc6fbc89fab2f5cfeb2a978a
|
|
BLAKE2b-256 checksum How to use checksums |
0b5e2c7e90ed47bddb8135436fe43bf7041b44f32fe6030da101cef6255d1dd6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Nov 2, 2026.
Transparency logRelease files / prism_q-0.37.0-cp311-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
| Download URL | prism_q-0.37.0-cp311-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl |
|---|---|
| Size | 3.9 MB |
| Tags | CPython 3.11 Linux glibc 2.17+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
cae69ebfb1b15c1deb98252236a2d72960965c03290369d057822dc3f435aa2f
|
|
BLAKE2b-256 checksum How to use checksums |
d6db23e816d78e5fab6633869bcd12591f9d295acd3a18ac7a474e5b2ee106ab
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Nov 2, 2026.
Transparency logRelease files / prism_q-0.37.0-cp311-abi3-macosx_11_0_arm64.whl
| Download URL | prism_q-0.37.0-cp311-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 3.5 MB |
| Tags | CPython 3.11 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
051b37915e64e86a8864c61d8cdc9bb8b30f34686eee2129d593fe242de0f2ea
|
|
BLAKE2b-256 checksum How to use checksums |
8f4a361488dc92e2420c8a12a3b194c77f24df6a716a527ac8fd159ab2ee0519
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Nov 2, 2026.
Transparency logSecurity for prism-q 0.37.0
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.
Full provenance
All 5 files in this release have been uploaded with provenance metadata.
Attestation for prism_q-0.37.0.tar.gz
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 Nov 2, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.