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.3.1.tar.gz (66.9 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.3.1-py3-none-win_amd64.whl (999.6 kB view details)

Uploaded Python 3Windows x86-64

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

Uploaded Python 3manylinux: glibc 2.39+ x86-64

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

Uploaded Python 3manylinux: glibc 2.35+ x86-64

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

Uploaded Python 3macOS 15.0+ x86-64

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

Uploaded Python 3macOS 15.0+ ARM64

pyqrack-2.3.1-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.3.1.tar.gz.

File metadata

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

File hashes

Hashes for pyqrack-2.3.1.tar.gz
Algorithm Hash digest
SHA256 5d5891d5178c756b3715f0c51604402d5ba093304c833a10e811b011d818b19b
MD5 0ea356b38585db5547e44ed24d10c194
BLAKE2b-256 5fa7c8decc465ada0e8745e264a9991afd59eced2e7e7836236b82bf640aa90a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pyqrack-2.3.1-py3-none-win_amd64.whl
  • Upload date:
  • Size: 999.6 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.3.1-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 d44ed3fc5d0afd8d08a1aa1d3265853b25de3071f94b58eccf18fdc4482194af
MD5 2a72d5c7c101143d382ba1eb9ba898b1
BLAKE2b-256 637aa28865aa90ffa567f26b1397c8ae5f36b7f9e94f51a306b934da7b43e8f4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack-2.3.1-py3-none-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 747ba91789e5c66dffeda19efaf1ecb612be6da3dba6ea91d0928728320ba64a
MD5 340f9b985bbf9d1da63d1e28df9d9c74
BLAKE2b-256 f1397111765299713918a98250b488f725f6350e77e5b91f054617f28d1203b5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack-2.3.1-py3-none-manylinux_2_35_x86_64.whl
Algorithm Hash digest
SHA256 9ab68f2f27029f7686bc5030772f51231e82b4d36bbf623d62a4b396ee15b411
MD5 fa12cb71b808e49867926adabf491fa5
BLAKE2b-256 d74fe0aeb6d6e3dd87e9915503f0d0e9d8a9f54514ac65b65fc9d456c7f0ceaf

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack-2.3.1-py3-none-macosx_15_0_x86_64.whl
Algorithm Hash digest
SHA256 c553ee7f3f31c801fb7256810e44828cbab9c22df203ff55c9e939af92ba65b4
MD5 1abc9716eae50185b4b4b780ee55784a
BLAKE2b-256 0bcd064185949156a7a2edbc72007becfa09538836f68bae8c62ac1cc65b84ad

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack-2.3.1-py3-none-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 25ec8a1f135bf2d072c56d84c9a9983d0ee22215f5f7a836dc6e755ab791ff71
MD5 386c95648def5935200f31a64553d058
BLAKE2b-256 7bb3ba54326083dd19609fdd53f4f1c3c2bfba53647f704651ad03013f9ec875

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack-2.3.1-py3-none-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 4b3116dd4f3a5ce9023f70753a2256ea75380623dd5a60a8643b2236ddbdf1f4
MD5 b3b14ea6d5639bfaa2d71b4919263935
BLAKE2b-256 2fb12d46eace9bbacf6baa98c175d91ce763312611e66b177a8ecd9b2afaabcf

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