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-2.9.0.tar.gz (62.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-2.9.0-py3-none-win_amd64.whl (1.0 MB view details)

Uploaded Python 3Windows x86-64

pyqrack-2.9.0-py3-none-manylinux_2_39_x86_64.whl (3.7 MB view details)

Uploaded Python 3manylinux: glibc 2.39+ x86-64

pyqrack-2.9.0-py3-none-manylinux_2_35_x86_64.whl (3.7 MB view details)

Uploaded Python 3manylinux: glibc 2.35+ x86-64

pyqrack-2.9.0-py3-none-macosx_15_0_x86_64.whl (2.1 MB view details)

Uploaded Python 3macOS 15.0+ x86-64

pyqrack-2.9.0-py3-none-macosx_15_0_arm64.whl (1.9 MB view details)

Uploaded Python 3macOS 15.0+ ARM64

pyqrack-2.9.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-2.9.0.tar.gz.

File metadata

  • Download URL: pyqrack-2.9.0.tar.gz
  • Upload date:
  • Size: 62.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for pyqrack-2.9.0.tar.gz
Algorithm Hash digest
SHA256 447083c5c816cf6b6e12550be0f3341cf929f495c948d70d2ddcf22144a09ee6
MD5 d0d2109497c64ff3b8090966c13e872f
BLAKE2b-256 d27a4ae90b0d5f60cb18fc78b5ed1ed3313fdc91c0f651bd08e15973ba06e737

See more details on using hashes here.

File details

Details for the file pyqrack-2.9.0-py3-none-win_amd64.whl.

File metadata

  • Download URL: pyqrack-2.9.0-py3-none-win_amd64.whl
  • Upload date:
  • Size: 1.0 MB
  • Tags: Python 3, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for pyqrack-2.9.0-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 1ddced62f93a7c7bee220e31d410bab36e2b792067a25ae710c1c82d0dbd5cd9
MD5 15bc3591a312b3a22eeb9bd8a2e020df
BLAKE2b-256 c77f20d64de8642fb89fd2cb343961ef72ac521580d4985e682a4efde079ec63

See more details on using hashes here.

File details

Details for the file pyqrack-2.9.0-py3-none-manylinux_2_39_x86_64.whl.

File metadata

File hashes

Hashes for pyqrack-2.9.0-py3-none-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 ad92c64726e3281f3da7ddddc33d17ff2345a2e11e34bf4127710e2f77460cc4
MD5 264345500c73dcc5edf64bad30920f8b
BLAKE2b-256 a6c6f7b6d175264b9798d7937376cb3dc5f73591a4724e76c7b0a9795710e731

See more details on using hashes here.

File details

Details for the file pyqrack-2.9.0-py3-none-manylinux_2_35_x86_64.whl.

File metadata

File hashes

Hashes for pyqrack-2.9.0-py3-none-manylinux_2_35_x86_64.whl
Algorithm Hash digest
SHA256 5046059caadd6e91f7ad5608150ebbfffdab8865f5a342f10c9ace185af62c02
MD5 2acf5e28ee404d15048a9e5ffb9d8403
BLAKE2b-256 45f1af082af3dd5f92c5c20dafdce7d7465eeaa098f1d8bc06d97619d711d971

See more details on using hashes here.

File details

Details for the file pyqrack-2.9.0-py3-none-macosx_15_0_x86_64.whl.

File metadata

File hashes

Hashes for pyqrack-2.9.0-py3-none-macosx_15_0_x86_64.whl
Algorithm Hash digest
SHA256 d82e784717d72e0ce9846f46518bc93417c47ef7e84bf2abe76741bca69ef884
MD5 3567ce1dd8a79267c3497bd394610ed1
BLAKE2b-256 1d6a1c1962ccb7160fa3fadadf569810ee42917b202786ffaf39217d42854139

See more details on using hashes here.

File details

Details for the file pyqrack-2.9.0-py3-none-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for pyqrack-2.9.0-py3-none-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 3ea3ef95c2871a864722dd57a591d681d81c5e0f1123b64da547923d5a7def1c
MD5 eba63e5bdf0bc1aafb66075418157f90
BLAKE2b-256 b46226134289526bcd4fd89f6c131800a7aa2585f0a639d26fe8d0d6e11df161

See more details on using hashes here.

File details

Details for the file pyqrack-2.9.0-py3-none-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for pyqrack-2.9.0-py3-none-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 a31ad11d250da9463f4c941633d53ef11e5161837b44dca99a915b9b7349a8d4
MD5 47f5c298846b2a28d5132513548e0565
BLAKE2b-256 2b3e0b1db85c5d7e272f8452ec249a4608021f85569f2ca3f070aef891d4c7a0

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