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.83.1.tar.gz (51.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_complex128-1.83.1-py3-none-win_amd64.whl (1.0 MB view details)

Uploaded Python 3Windows x86-64

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

Uploaded Python 3manylinux: glibc 2.39+ x86-64

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

Uploaded Python 3manylinux: glibc 2.35+ x86-64

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

Uploaded Python 3macOS 15.0+ x86-64

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

Uploaded Python 3macOS 15.0+ ARM64

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

File metadata

  • Download URL: pyqrack_complex128-1.83.1.tar.gz
  • Upload date:
  • Size: 51.9 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.83.1.tar.gz
Algorithm Hash digest
SHA256 843fe561e9c58064f90e18fb46f37a78f179fb4e31f4014c61c0d03be7672621
MD5 3ec7cfdb64f604d09e94b5c4379e0aea
BLAKE2b-256 b1a5c22cf21d76cab995676521f222f9b823d02d2e6e42007692017b6dfb20df

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack_complex128-1.83.1-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 345c9d853732fdd4b030a07cb6b465136624883fbb3bd0e66be246bdd2a38325
MD5 f794d7e20a967f992b79c0f90f1615e7
BLAKE2b-256 66078ccce0bb3e4e2daf5331d8f1d01b55979c7163d74e19c24b2b057ec12fd9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack_complex128-1.83.1-py3-none-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 c637073ae1aaa2d3183c1fb70a3489879854c5df7748f118c018714c9bf93a89
MD5 9c5a87f1ebdb35606b1248aebbeca704
BLAKE2b-256 3c5f86d9780f032f5fe0ee873d21413bd9d78bb83a7637d3ccc54e030dcd41f9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack_complex128-1.83.1-py3-none-manylinux_2_35_x86_64.whl
Algorithm Hash digest
SHA256 16df83ae3805e17bae8998e66bdb3220cbdbbc013440b9ac14a983917eea3b3e
MD5 d6aaeab77eccb8de4c068044d9898227
BLAKE2b-256 8d502b0dd2556e281ac2ed9b745ad548c48c1dda4d6e18bc0f58a4b20f479b72

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack_complex128-1.83.1-py3-none-macosx_15_0_x86_64.whl
Algorithm Hash digest
SHA256 4e91f5caa685abf9e31e125ec23029d30803eecdf1381bd4b7d0b5dbe9f41568
MD5 d3cbcdfef1ddd40d1ee31a32fdd93c8a
BLAKE2b-256 45d908986053f079f155f2cb84d8b249255dc9de880a7f043e7f2fbdf39fd568

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack_complex128-1.83.1-py3-none-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 8e1597c36caba0fc9b02ea2dc2e7dbd89aa0250ee89fc8a60ae14e5b0525db11
MD5 eeba8312fc3093dc4b417db95579a31b
BLAKE2b-256 1e54e55db93544b16e0695d1fa6001314b21b0fbe7013017cab3904fcc24e887

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack_complex128-1.83.1-py3-none-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 5fa7130610dbe62976bef02ad5f4b7fab02975f16c2b01068e790533d05439b7
MD5 9759c963406e4680ac93b0a3b1182489
BLAKE2b-256 964403cbd0da1aff77bff5bc53a1359c7b1b4a9a32513fc055f5579e59b810f9

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