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

Uploaded Python 3Windows x86-64

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

Uploaded Python 3manylinux: glibc 2.39+ x86-64

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

Uploaded Python 3manylinux: glibc 2.35+ x86-64

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

Uploaded Python 3macOS 15.0+ x86-64

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

Uploaded Python 3macOS 15.0+ ARM64

pyqrack-2.12.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.12.0.tar.gz.

File metadata

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

File hashes

Hashes for pyqrack-2.12.0.tar.gz
Algorithm Hash digest
SHA256 caa36ae5332ab863dc9de67666679acb4830595ab4fc368cbe56d96aaed7a494
MD5 9ba7f68e1f3157899d9613541d05cffc
BLAKE2b-256 c52402e68cf14b784e717ff12dec19928b5474f5a14d2945b6250cda7e7ca8b8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pyqrack-2.12.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.11.15

File hashes

Hashes for pyqrack-2.12.0-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 875a857fc24b831fd800ea07b4c382bdeeaa15325791fd6bafff5a69df57d16a
MD5 762e0de0c552d37bff64b587237bd582
BLAKE2b-256 30711e9fc5d6a815753a170497670871ebdd76dcd23c4e773a5e3da0e026e050

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack-2.12.0-py3-none-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 606af0991cc08bcdc4f4712d90ee6bd0b049ee1c57e3f9484b01d284db25890a
MD5 b75013698e33fa3e84d7a31353a045f5
BLAKE2b-256 ab9f3edcd2bd9e6c3b65a3d482f8260b8c7e3bfc544b703041074f36982674f9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack-2.12.0-py3-none-manylinux_2_35_x86_64.whl
Algorithm Hash digest
SHA256 27521ba8b321d205be5821e81d43df08e5c763ec03dea60a2b0d64733552c428
MD5 ff0d14fd52dfc9ff3d62ac67ec8b9a8a
BLAKE2b-256 d177fea2edf3606a2516f668b34b378e28ce0c5319a7e047ca778463233eb106

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack-2.12.0-py3-none-macosx_15_0_x86_64.whl
Algorithm Hash digest
SHA256 8161887fb7be9f79721fb2408e4715a0bb3924307d9294724ffee34dbb16a9c6
MD5 1db38d3f1ac315a993bb42247b3baa48
BLAKE2b-256 d4c43ba9cd347e8bea8c2dd5b8bf03b89600d7c0b101941a7443b9c0f5a8ff03

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack-2.12.0-py3-none-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 11cf6a536c522c083efddbb525606a9d87695936aebce328862e58b15ff2551e
MD5 5029d2f83291a4f6fa7ea2c87f351e6a
BLAKE2b-256 89c14a743d445caec9a03304f25596af254a0208c47caa417c3b8e79adcd47f3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack-2.12.0-py3-none-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 dbaced78cbbb7315e7c7902895086a52946c1e7d0041b47d593411479f85fc2e
MD5 9e716f24e268ac14b39b8ac31e21ba47
BLAKE2b-256 7e335345c97dd7e2869947e780b1af92387fa4c67f39f81cced076f084a166d5

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