Skip to main content

pyqrack - Pure Python vm6502q/qrack Wrapper

Project description

pyqrack

Downloads Downloads Downloads

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

(PyQrack is just pure Qrack.)

This is the purely CPU-based variant of PyQrack (with module name pyqrack-cpu). This alternate build of PyQrack is provided so that systems that won't use OpenCL or CUDA anyway (such as because they lack any GPUs or other accelerators like the Intel HD) do not need to install the OpenCL library in order to use PyQrack. In this form, both the PyQrack module and the underlying C++ Qrack library are entirely external dependency-free.

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

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!

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

pyqrack_cpu-1.82.0.tar.gz (51.7 kB view details)

Uploaded Source

Built Distributions

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

pyqrack_cpu-1.82.0-py3-none-win_amd64.whl (752.7 kB view details)

Uploaded Python 3Windows x86-64

pyqrack_cpu-1.82.0-py3-none-manylinux_2_39_x86_64.whl (2.8 MB view details)

Uploaded Python 3manylinux: glibc 2.39+ x86-64

pyqrack_cpu-1.82.0-py3-none-manylinux_2_35_x86_64.whl (2.8 MB view details)

Uploaded Python 3manylinux: glibc 2.35+ x86-64

pyqrack_cpu-1.82.0-py3-none-macosx_15_0_x86_64.whl (2.1 MB view details)

Uploaded Python 3macOS 15.0+ x86-64

pyqrack_cpu-1.82.0-py3-none-macosx_15_0_arm64.whl (1.9 MB view details)

Uploaded Python 3macOS 15.0+ ARM64

pyqrack_cpu-1.82.0-py3-none-macosx_14_0_arm64.whl (1.9 MB view details)

Uploaded Python 3macOS 14.0+ ARM64

File details

Details for the file pyqrack_cpu-1.82.0.tar.gz.

File metadata

  • Download URL: pyqrack_cpu-1.82.0.tar.gz
  • Upload date:
  • Size: 51.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for pyqrack_cpu-1.82.0.tar.gz
Algorithm Hash digest
SHA256 686c1e90a5fa19d1b48fdb6a381e66dcb257a0d64249954fd5a998d95d6335ee
MD5 03b05825b31089a201c5a68a7a6bc2ec
BLAKE2b-256 7903eb167d10e62ba6e03f2d50a7cb0a6edc5d6b79c6df4dfc442b63e60cdc03

See more details on using hashes here.

File details

Details for the file pyqrack_cpu-1.82.0-py3-none-win_amd64.whl.

File metadata

  • Download URL: pyqrack_cpu-1.82.0-py3-none-win_amd64.whl
  • Upload date:
  • Size: 752.7 kB
  • Tags: Python 3, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for pyqrack_cpu-1.82.0-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 e2b788c04da64d8dbbdb463cb271d34cb4cd50a9e65578380de344f1272e8bd0
MD5 80afbea418cac34afb5fb90a440a0680
BLAKE2b-256 4e17ae3e34df80fac5c665d2e69b036c8b20d200b3fef30e512c0ad27e1b5d13

See more details on using hashes here.

File details

Details for the file pyqrack_cpu-1.82.0-py3-none-manylinux_2_39_x86_64.whl.

File metadata

File hashes

Hashes for pyqrack_cpu-1.82.0-py3-none-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 8db6c4a39bcf0584cfa74e735fa244e2a2739f518263b02d4d56678f6ed2f745
MD5 240502c0149cc452bda75a5d37b336a3
BLAKE2b-256 56dac14154c85a66135a3b2f0ae0da80915077b08e33f70d330ddec2b91f0026

See more details on using hashes here.

File details

Details for the file pyqrack_cpu-1.82.0-py3-none-manylinux_2_35_x86_64.whl.

File metadata

File hashes

Hashes for pyqrack_cpu-1.82.0-py3-none-manylinux_2_35_x86_64.whl
Algorithm Hash digest
SHA256 3d39aff20a8daa5bcebeb9a9417e135577975bc73ca13db9b738f6d3c889343a
MD5 e7c538f077c5e63f4b4147fc393fc489
BLAKE2b-256 04d6eee1b383c5c5980aee369d01f2a5e45b13c03d1669681f62a7605fb6056f

See more details on using hashes here.

File details

Details for the file pyqrack_cpu-1.82.0-py3-none-macosx_15_0_x86_64.whl.

File metadata

File hashes

Hashes for pyqrack_cpu-1.82.0-py3-none-macosx_15_0_x86_64.whl
Algorithm Hash digest
SHA256 6fcba8f1ece4b13f5e4ccfd72043274149a52c5680fdee7ef985b6f91b191818
MD5 14beda766bdeb7e83c9a00e151d4b194
BLAKE2b-256 934d22ce8d60ea57c53d546554399f79805c35515bcc4eb3671b7fa9b4dfc0a5

See more details on using hashes here.

File details

Details for the file pyqrack_cpu-1.82.0-py3-none-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for pyqrack_cpu-1.82.0-py3-none-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 0f95057c5e2b036b9583a59ceb2d13148be71c0046ce3473c83bba93fab715c5
MD5 34fb965a44546d87cf9a08c4d260c41f
BLAKE2b-256 ec210d64c05013500fbe317da1735010be045ed2b6060befd86f8d90b5d005a7

See more details on using hashes here.

File details

Details for the file pyqrack_cpu-1.82.0-py3-none-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for pyqrack_cpu-1.82.0-py3-none-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 7e987c352bca9525e8fe36f606724062dab808f6c8278657011523ff2e691a45
MD5 c43ee1706995e59a38f10b23859e32ac
BLAKE2b-256 787abeaf3a4c7cb99c394bb53bb2b0ead08a26ec4f8265ff0219475760d5cb06

See more details on using hashes here.

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