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

Uploaded Python 3Windows x86-64

pyqrack_complex128-1.78.5-py3-none-manylinux_2_39_x86_64.whl (3.4 MB view details)

Uploaded Python 3manylinux: glibc 2.39+ x86-64

pyqrack_complex128-1.78.5-py3-none-manylinux_2_35_x86_64.whl (3.4 MB view details)

Uploaded Python 3manylinux: glibc 2.35+ x86-64

pyqrack_complex128-1.78.5-py3-none-macosx_15_0_x86_64.whl (2.1 MB view details)

Uploaded Python 3macOS 15.0+ x86-64

pyqrack_complex128-1.78.5-py3-none-macosx_15_0_arm64.whl (1.9 MB view details)

Uploaded Python 3macOS 15.0+ ARM64

pyqrack_complex128-1.78.5-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.78.5.tar.gz.

File metadata

  • Download URL: pyqrack_complex128-1.78.5.tar.gz
  • Upload date:
  • Size: 52.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.78.5.tar.gz
Algorithm Hash digest
SHA256 099e3498793c62ce93d813a005a3dcc3dd14d08e6d9ff44860fd5cac164fe7e7
MD5 99e4dbeb6e551b3850b2cac7d15ed654
BLAKE2b-256 946b58b9e9593490b77e590d1c66148a9abeaa3def63d439f6e7d1504c458e9b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack_complex128-1.78.5-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 a77c00d5a23a3fc0f0a1ca59aa6d01d23af20224e11b0db645f1b2a3801053df
MD5 77e90609370b94bc158fd17074c68602
BLAKE2b-256 d91802b033e61a00518822b4d8ad8ad584b0ef6631412c3f8cb328c273ef5fed

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack_complex128-1.78.5-py3-none-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 e1294bca4f9a2a06c59812146a4dad8e3560db69e169de0b3f27fd78496d8f56
MD5 6fdd2d0df51b692d9a4df82dee75a47a
BLAKE2b-256 6975cc912ad4a6c0a703fb5cfc78fc5833d6ba949f99f42fcb79659cf6bf47a3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack_complex128-1.78.5-py3-none-manylinux_2_35_x86_64.whl
Algorithm Hash digest
SHA256 5ff425ef2c32b920972327b667035e0e290e3b0d62f615593389968e9a61f93d
MD5 74dcf2037a8d6aa866944e16ed30d213
BLAKE2b-256 d29ace89e62b98861515ee97792e5c57da71281a082fc1f9ded8b1e80e11a67e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack_complex128-1.78.5-py3-none-macosx_15_0_x86_64.whl
Algorithm Hash digest
SHA256 591e3f7e03c2029a4c09ab08dd51c64eaec1d1b77be887f3f5a2a5741dd4b6df
MD5 9a61774590e07ed9eeb087f0b252cf94
BLAKE2b-256 d2d5b367664566fe4ea2c83253dc74d39d95665ca48fe557a27527215f7525db

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack_complex128-1.78.5-py3-none-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 a56df4cb6135b89287f28d5097e50e2b861acc13f663e923fca43ad284d64a13
MD5 417582526cbe0d56f9153a3ae1bed914
BLAKE2b-256 c95255f9e1138c2a039a4479cbcca4a75e3dd3c59bdd01d74a455195cd2c2c94

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack_complex128-1.78.5-py3-none-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 98479c9745209cf97abfdbdf5d560563edf1eca01989753f38a138eae851ba72
MD5 06be7f135d10b88180e675de8028719a
BLAKE2b-256 469fa934565d053721feed4eade8082a3799ebd429009b4773d12c4555ac0285

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