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_complex128-1.87.3.tar.gz (56.1 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-1.87.3-py3-none-win_amd64.whl (977.0 kB view details)

Uploaded Python 3Windows x86-64

pyqrack_complex128-1.87.3-py3-none-manylinux_2_39_x86_64.whl (3.6 MB view details)

Uploaded Python 3manylinux: glibc 2.39+ x86-64

pyqrack_complex128-1.87.3-py3-none-manylinux_2_35_x86_64.whl (3.6 MB view details)

Uploaded Python 3manylinux: glibc 2.35+ x86-64

pyqrack_complex128-1.87.3-py3-none-macosx_15_0_x86_64.whl (2.0 MB view details)

Uploaded Python 3macOS 15.0+ x86-64

pyqrack_complex128-1.87.3-py3-none-macosx_15_0_arm64.whl (1.8 MB view details)

Uploaded Python 3macOS 15.0+ ARM64

pyqrack_complex128-1.87.3-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_complex128-1.87.3.tar.gz.

File metadata

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

File hashes

Hashes for pyqrack_complex128-1.87.3.tar.gz
Algorithm Hash digest
SHA256 bb8a9a1875d58fdd1ade70a92e1a1b92390ac63707a8ecef1566c9ff9ddeb197
MD5 ec3cd6aa12a8e8f5bcc8a913a6ceadc3
BLAKE2b-256 716fe80641fa2b95d2966d210f5842325fadf7774af403a6ce3cdefa5d79aa47

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack_complex128-1.87.3-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 8b1db277c93de4b1645900503666ffcf486c7850e42a8ce385b164bf70a43775
MD5 1d28de06acf12d4ab7279c7e4dae057f
BLAKE2b-256 63627fff8dd54ddac843b92a56a420c6acddf9c2c9797ed04e771d8510e7db9f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack_complex128-1.87.3-py3-none-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 d1d0841f15007f18973a72795f13534d48c4b52313709021ff0f7d6542f784e0
MD5 f6f138cdbc2ec23b91f51c6b9638656c
BLAKE2b-256 07ed67d213bf00e276aef937499269998bd3907123399fd1d8722c166a1aa9c6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack_complex128-1.87.3-py3-none-manylinux_2_35_x86_64.whl
Algorithm Hash digest
SHA256 80a25ddd0ecc9842e47e93f791240ed362f9928bb67be403ac1944b840029a78
MD5 0f4c5163fc733bda9307de760b0cc262
BLAKE2b-256 f37f8ec4225d2902b230e5555694727994e5c3af700ad7199c032fdec98110ef

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack_complex128-1.87.3-py3-none-macosx_15_0_x86_64.whl
Algorithm Hash digest
SHA256 2b160bfc9435b39f24ba4630ebc810c53fbe8c34525f81cf2009a671cfe1bd4e
MD5 4a33e056ee38305923377974b7229bc1
BLAKE2b-256 2eaff669a8fb40c8f991464f2d5e396dda4701672cce7d0e1d5f753d97fa9081

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack_complex128-1.87.3-py3-none-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 554a18c5c9ef94852a6d59506e9b7351c4b3a9295a464aa7e2ee09445b79cdb7
MD5 4b0e599ee40034d87e22af01e28f4620
BLAKE2b-256 4a8094aec9aea184f389827a0c442f9b41813ba5cc73b51688dbdd0acc97a4c9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack_complex128-1.87.3-py3-none-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 f7decf270d15e179c59e830f635ee7117ce5f6a0d8d329bf652b32340f3dfa9f
MD5 dca70b2de01223242189b96e28b7fc23
BLAKE2b-256 087dc3c12d925d348191b139c4e5b2a05e1009e9d5c3c851b4719a57cd58d71d

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