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!

Download files

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

Source Distribution

pyqrack_complex128-2.14.0.tar.gz (67.8 kB view details)

Uploaded Source

Built Distributions

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

pyqrack_complex128-2.14.0-py3-none-win_amd64.whl (1.0 MB view details)

Uploaded Python 3Windows x86-64

pyqrack_complex128-2.14.0-py3-none-manylinux_2_39_x86_64.whl (3.7 MB view details)

Uploaded Python 3manylinux: glibc 2.39+ x86-64

pyqrack_complex128-2.14.0-py3-none-manylinux_2_35_x86_64.whl (3.7 MB view details)

Uploaded Python 3manylinux: glibc 2.35+ x86-64

pyqrack_complex128-2.14.0-py3-none-macosx_15_0_x86_64.whl (2.1 MB view details)

Uploaded Python 3macOS 15.0+ x86-64

pyqrack_complex128-2.14.0-py3-none-macosx_15_0_arm64.whl (1.9 MB view details)

Uploaded Python 3macOS 15.0+ ARM64

pyqrack_complex128-2.14.0-py3-none-macosx_14_0_arm64.whl (2.0 MB view details)

Uploaded Python 3macOS 14.0+ ARM64

File details

Details for the file pyqrack_complex128-2.14.0.tar.gz.

File metadata

  • Download URL: pyqrack_complex128-2.14.0.tar.gz
  • Upload date:
  • Size: 67.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for pyqrack_complex128-2.14.0.tar.gz
Algorithm Hash digest
SHA256 6ccea278c313b13a5ba1ea8b03af925358f18b4b2b6cb3fcce35b7110ea38a4f
MD5 a620dc5e969c164ff98a9046a6dcdec1
BLAKE2b-256 b34ca3ff269e311b31f690f46c9dbb83f78412bbc70e419dd05384ea8e5e22c6

See more details on using hashes here.

File details

Details for the file pyqrack_complex128-2.14.0-py3-none-win_amd64.whl.

File metadata

File hashes

Hashes for pyqrack_complex128-2.14.0-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 f013fb5b0d8d5be92f0b4c5620b674ff574fc3c447efcf007456065f0dfc6fa8
MD5 6ec9e7ba67608450901c62632d0347c3
BLAKE2b-256 4c3bab26012c9aeb0f8db6778cc486e24ef7dac828f9ce20211f93f3234ccbae

See more details on using hashes here.

File details

Details for the file pyqrack_complex128-2.14.0-py3-none-manylinux_2_39_x86_64.whl.

File metadata

File hashes

Hashes for pyqrack_complex128-2.14.0-py3-none-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 0fdf1a86a6281d2b6bbbe25df95211e8ea73acaf090fbd4190d32ca580d3a5b1
MD5 333fa62324e1f7346f7fdbe9fe8b60c7
BLAKE2b-256 22c83fc5dbb57f8d4c02b33697c3dc13eed7794f771a4f8e8d07c4e053f9dbe4

See more details on using hashes here.

File details

Details for the file pyqrack_complex128-2.14.0-py3-none-manylinux_2_35_x86_64.whl.

File metadata

File hashes

Hashes for pyqrack_complex128-2.14.0-py3-none-manylinux_2_35_x86_64.whl
Algorithm Hash digest
SHA256 19ab6c413fde5b6a8e03a9df2f1c9f2345e1510a97a8b123c6cd1e6414564e29
MD5 295e40d69d4e3fa0b5b06dfa0f0d2548
BLAKE2b-256 429ecb3223c50036dfd0f5dfbca0c4c62401a1d8a003927b525200d4605c2e48

See more details on using hashes here.

File details

Details for the file pyqrack_complex128-2.14.0-py3-none-macosx_15_0_x86_64.whl.

File metadata

File hashes

Hashes for pyqrack_complex128-2.14.0-py3-none-macosx_15_0_x86_64.whl
Algorithm Hash digest
SHA256 ba422d86b81c003d0582f1c81e8c13eb61213f70edd4273fb6a8e0734a145bfe
MD5 09b75de2544b1e2c1e4f19d03810d212
BLAKE2b-256 0626ec11024b0f03e6ba94aecf4a26379a80365e9858445e34e522f797d39003

See more details on using hashes here.

File details

Details for the file pyqrack_complex128-2.14.0-py3-none-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for pyqrack_complex128-2.14.0-py3-none-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 c704fdc697e57b53c22421cee18446e2e93b8c491fc7cf82a4f6b79c0a0f1477
MD5 691397d18065d2839c082e004fff7785
BLAKE2b-256 5e198d11cd32ababa748151a8cd6e243a4ac630f9f7f6ad4401c16eebe3bc118

See more details on using hashes here.

File details

Details for the file pyqrack_complex128-2.14.0-py3-none-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for pyqrack_complex128-2.14.0-py3-none-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 03a74ded89ae778a3a976f09d5d73016baa82d629a46c9a2587e6124c35dcfeb
MD5 2b841299eb0108716e7f9649bab7809c
BLAKE2b-256 7662122bcfea62f224ff5bd47a89e1ebc6312fb6857b5df915963e1153d68a76

See more details on using hashes here.

Release history Release notifications | RSS feed

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