Skip to main content

pyqrack - Pure Python vm6502q/qrack Wrapper

Project description

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!

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-2.5.0.tar.gz (60.3 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.5.0-py3-none-win_amd64.whl (992.7 kB view details)

Uploaded Python 3Windows x86-64

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

Uploaded Python 3manylinux: glibc 2.39+ x86-64

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

Uploaded Python 3manylinux: glibc 2.35+ x86-64

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

Uploaded Python 3macOS 15.0+ x86-64

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

Uploaded Python 3macOS 15.0+ ARM64

pyqrack-2.5.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.5.0.tar.gz.

File metadata

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

File hashes

Hashes for pyqrack-2.5.0.tar.gz
Algorithm Hash digest
SHA256 18db60843ce915954c46877fb6add5159fe8c54d5f75760438e327c20358da77
MD5 e119eab0d88d617e31b59a935dfa8a9c
BLAKE2b-256 89fedce2b701d587d5a5ce01da99c48a841128e58467e50130c1d0a6891054b9

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pyqrack-2.5.0-py3-none-win_amd64.whl
  • Upload date:
  • Size: 992.7 kB
  • 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.5.0-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 e8b5651911409d4508c6738c88c5b3b60dfd380ac2f45dd08e549100a34f23e3
MD5 894cd6feb64a90726dd0264d8853fa3f
BLAKE2b-256 c5dc3a922d38a519735eaba8e9903726b4d7548bdc08ddc7ce7f396348cb75e7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack-2.5.0-py3-none-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 06095a53b1e5da315b08700f695b18c90f89543e92920bced1bd0855b9f732c5
MD5 4ef3fa12dd02862510c789dbf84853a9
BLAKE2b-256 553b015f2e30e8d6ec43910e80d37f9c6d6e29a7c74cef6fa9f8de1b1d93242c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack-2.5.0-py3-none-manylinux_2_35_x86_64.whl
Algorithm Hash digest
SHA256 715af15d42a94bcabe86eaa88d7dc7fc7ea6f9f12f5b9e765b8fc9dc66decbf2
MD5 fb16d96e3881b0998c24f29defa2772d
BLAKE2b-256 0ded352b333e97616809fbf8bb43ae51db5d52f25a28e1b332cb9bc0e85217da

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack-2.5.0-py3-none-macosx_15_0_x86_64.whl
Algorithm Hash digest
SHA256 3e248a38b18a8bf13b613987e76a98384736656a5693a1d180ec1f36ffae41a2
MD5 765bac0a0e2fd4f15271ca25f5ec2f04
BLAKE2b-256 c4bacc9d427a9902af36004b3b0b797627f46d2bf31bd203e98395d67cc764ad

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack-2.5.0-py3-none-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 2499f8f2ed7b30356aeb7884de8dd0d34e2e7f689ef6fd781b6760b34d84ee95
MD5 ccb90d9083e5d17115b7807704a1de30
BLAKE2b-256 9636af0b30c3f61e1549872782abfd8f55c197a94506b2d674d9bf7a9817a3e8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack-2.5.0-py3-none-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 c5580983d61a0f27177085adec518b2eef0b9672def6cd7a00718636d5e77a13
MD5 a7539e04de5e1984b752cb8266e35056
BLAKE2b-256 e4520d192829e9ff346a5444425f833fab4b53cdb7c22c4bb273edc9f2bfec00

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