Skip to main content

pyqrack

Downloads Downloads Downloads

Pure Python bindings for the pure C++11/OpenCL Qrack quantum computer simulator library

(PyQrack is just pure Qrack.)

Note: You must also install OpenCL to use this version of Qrack. (There are also CPU-only and CUDA version.)

If you're looking for Mac ARM support, use the package pyqrack, not pyqrack-cpu. Mac officially "deprecated" OpenCL years ago. Hence, accelerator support is not included in ARM-based Mac wheels, and OpenCL installation is not required on these systems, but, if you have a CUDA accelerator on ARM-based Mac, you could try the package pyqrack-cuda instead.

Performance can benefit greatly from following the Qrack repository "Quick Start" and "Power user considerations."

If you use an integrated graphics accelerator, like the Intel HD, setting environment variable PYQRACK_HOST_POINTER_DEFAULT_ON=1 (or to any "truthy" value) will automatically set the default of isHostPointer option of QrackSimulator to True, to engage "zero-copy" mode by default.

Import and instantiate QrackSimulator instances. This simulator can perform arbitrary single qubit and controlled-single-qubit gates, as well as other specific gates like SWAP.

Any 2x2 bit operator matrix is represented by a list of 4 complex floating point numbers, in row-major order.

Single and array "b" parameters represent Pauli operator bases. They are specified according to the enumeration of the Pauli class.

MC[x] and MAC[x] methods are controlled single bit gates, with as many control qubits as you specify via Python list c argument. MCX is multiply-controlled Pauli X, and MACX is "anti-"controlled Pauli X, i.e. "anti-control" activates the gate if all control bits are specifically off, as opposed to on.

To load the required unitaryfund/qrack libraries from a different location, set the PYQRACK_SHARED_LIB_PATH environment variable.

PyQrack has experimental support for PyZX Circuit definitions as an intermediate representation for QrackSimulator. To try this, load a Circuit in PyZX, (use that module to optimize your circuit, as you like,) and create a QrackSimulator() instance using the pyzxCircuit named argument of the constructor, like so:

sim = QrackSimulator(pyzxCircuit=c)

where c is a PyZX circuit object. The circuit will automatically be simulated in the constructed QrackSimulator instance. This also allows loading from QASM and other intermediate representations supported by PyZX.

See https://pyqrack.readthedocs.io/en/latest/ for an API reference.

For custom Qrack build floating-point precision, where options are half, float, double, and quad, set an environment variable via export QRACK_FPPOW=[n] (or as appropriate to your shell) where [n] is the logarithm base 2 of the number of bits in the systemic floating point type (4, 5, 6, or 7, with 5 or float as default, i.e. 2**5=32 for 32-bit float). Your Qrack installation floating-point build option must match this specific value, which might require a custom Qrack build.

Please feel welcome to open an issue, if you'd like help. 😃

Special thanks go to Zeeshan Ahmed, for bug fixes and design suggestions, Ashish Panigrahi, for documentation and design suggestions, WingCode, for documentation, Or Golan, for CI build pipeline tooling, and to the broader community of Qrack contributors, for years of happy Qracking! You rock!

Metadata

Release files for pyqrack 2.31.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyqrack 2.31.1
File Size Uploaded Provenance Actions
pyqrack-2.31.1.tar.gz 92.7 kB Without provenance Details for pyqrack-2.31.1.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for pyqrack 2.31.1
File Actions
pyqrack-2.31.1-py3-none-win_amd64.whl Python 3 none Windows x86-64 Details for pyqrack-2.31.1-py3-none-win_amd64.whl
pyqrack-2.31.1-py3-none-manylinux_2_39_x86_64.whl Python 3 none Linux glibc 2.39+ x86-64 Details for pyqrack-2.31.1-py3-none-manylinux_2_39_x86_64.whl
pyqrack-2.31.1-py3-none-manylinux_2_35_x86_64.whl Python 3 none Linux glibc 2.35+ x86-64 Details for pyqrack-2.31.1-py3-none-manylinux_2_35_x86_64.whl
pyqrack-2.31.1-py3-none-macosx_15_0_arm64.whl Python 3 none macOS 15.0+ ARM64 Details for pyqrack-2.31.1-py3-none-macosx_15_0_arm64.whl

Total release size: 11.2 MB

Release files / pyqrack-2.31.1.tar.gz

Download URL pyqrack-2.31.1.tar.gz
Size 92.7 kB
Tags Source
SHA-256 checksum
How to use checksums
057be1dec72990ebe78c4c785ea211f48d4b36d8726472bfab479474e6789d2e
BLAKE2b-256 checksum
How to use checksums
3d67f057bc4ce4d3a0c27a8e93d84499fd8a8ed7ed93a58b369b3ab267eca21f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.4

Release files / pyqrack-2.31.1-py3-none-win_amd64.whl

Download URL pyqrack-2.31.1-py3-none-win_amd64.whl
Size 1.1 MB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
6dfeaae6b86f4a4d479fc3cae8643f3963a9bfc3553b94ec1b27ca2aaaf64473
BLAKE2b-256 checksum
How to use checksums
4286eadfbbc823f5205131d1958e6d73944b73b3c50620ce45d130c80c6d8261
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.4

Release files / pyqrack-2.31.1-py3-none-manylinux_2_39_x86_64.whl

Download URL pyqrack-2.31.1-py3-none-manylinux_2_39_x86_64.whl
Size 3.9 MB
Tags Linux glibc 2.39+ x86-64 Python 3
SHA-256 checksum
How to use checksums
af52c8cb5575e3bca67c17004d109c4686b5b9c0aaf6c31e134139e178834371
BLAKE2b-256 checksum
How to use checksums
7e02c4f187367ce3b3f5999ddc9a8060e0813679fb7ed5561683fbe70a32200e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.4

Release files / pyqrack-2.31.1-py3-none-manylinux_2_35_x86_64.whl

Download URL pyqrack-2.31.1-py3-none-manylinux_2_35_x86_64.whl
Size 4.0 MB
Tags Linux glibc 2.35+ x86-64 Python 3
SHA-256 checksum
How to use checksums
7dee3614f39d5e3f53575e1e9a257d40586508594d9bbfc1ff5a49fd8ac6ccde
BLAKE2b-256 checksum
How to use checksums
2c678a892c78c9f6364864ddedcfc37ea38ccab7ffd283bf5b9f43df2c544539
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.4

Release files / pyqrack-2.31.1-py3-none-macosx_15_0_arm64.whl

Download URL pyqrack-2.31.1-py3-none-macosx_15_0_arm64.whl
Size 2.1 MB
Tags Python 3 macOS 15.0+ ARM64
SHA-256 checksum
How to use checksums
087976db49704953ce419760dc8595bac7834792ffa99f503ee6fc075210ee31
BLAKE2b-256 checksum
How to use checksums
eba74d20ec08e0d5d7c92d6c8f381a6de2823faf3e5953b85f7d6bb2aedfcc83
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.4

Security for pyqrack 2.31.1

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A 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.

Release history Release notifications | RSS feed

This release

2.31.1 This release

5 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page