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-1.87.2.tar.gz (56.0 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

pyqrack-1.87.2-py3-none-win_amd64.whl (973.6 kB view details)

Uploaded Python 3Windows x86-64

pyqrack-1.87.2-py3-none-manylinux_2_39_x86_64.whl (3.6 MB view details)

Uploaded Python 3manylinux: glibc 2.39+ x86-64

pyqrack-1.87.2-py3-none-manylinux_2_35_x86_64.whl (3.6 MB view details)

Uploaded Python 3manylinux: glibc 2.35+ x86-64

pyqrack-1.87.2-py3-none-macosx_15_0_x86_64.whl (2.0 MB view details)

Uploaded Python 3macOS 15.0+ x86-64

pyqrack-1.87.2-py3-none-macosx_15_0_arm64.whl (1.8 MB view details)

Uploaded Python 3macOS 15.0+ ARM64

pyqrack-1.87.2-py3-none-macosx_14_0_arm64.whl (1.8 MB view details)

Uploaded Python 3macOS 14.0+ ARM64

File details

Details for the file pyqrack-1.87.2.tar.gz.

File metadata

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

File hashes

Hashes for pyqrack-1.87.2.tar.gz
Algorithm Hash digest
SHA256 fee973977d2c7efc99c73f003e152f5cdcee6f917db224c822174d5d2c2e9fab
MD5 571857f09f4012e1c623cd1616ca27dd
BLAKE2b-256 1eeef7aa4478201ecdb59930b979f7190bb264be10930ad49984d45c0b1d66af

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pyqrack-1.87.2-py3-none-win_amd64.whl
  • Upload date:
  • Size: 973.6 kB
  • Tags: Python 3, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for pyqrack-1.87.2-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 e73422a7999c8a16052fd3fbd01ccad41163ee7717517667cc693e30a6d8e524
MD5 d2703ff6d05cf8ee03cf0869b05d5c5b
BLAKE2b-256 6da3e99cedb6526942d83551e66c0ae3a4fec5bc07f92a73c9042fc91773e6cc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack-1.87.2-py3-none-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 019ccbd31d4ecad43b69aca2dc4c55696582102775432128bc0d968b6cfdd913
MD5 e491c3e93c4aedcf360ce37d87a8e36d
BLAKE2b-256 2c44afc1c16ee8b5c28558d9227edf3419f354e2f19b8236745fb9ce32ef1737

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack-1.87.2-py3-none-manylinux_2_35_x86_64.whl
Algorithm Hash digest
SHA256 f4fedffa5fa57d868fdf85a176f67ac2d13af138fbef2efc9dfde44f0831d00f
MD5 6a40216534992aa8de9c71f0971bf31a
BLAKE2b-256 26e39a125875b5bd09d0813bdd5d901f6cd45cf447319f98907e852526a9bb58

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack-1.87.2-py3-none-macosx_15_0_x86_64.whl
Algorithm Hash digest
SHA256 a7e1b4c02ae3def9aa819b199f9f5551885042022b6dcea076476f028e439d50
MD5 b4a0ea5cd2d98bcca29e695d571a15dd
BLAKE2b-256 867db4d338fb225c8456023a366854d556c5f762fe5d460b19ef7756e5526b3c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack-1.87.2-py3-none-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 933ffe052a4e0ad1abcada2f0b45c8f7c58a9e0b2fe3a7ac28a0cbfe7ddf376f
MD5 ed3c4238a280c98e1d9e26925873c58e
BLAKE2b-256 4f316f8120a6337124e05f7da9869bf007615670de2f4d77faa1d18958114f68

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack-1.87.2-py3-none-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 a60ab326756976ce95eaf6634fd765c7c3fafe57c2855de9ca8b3c812c97a26e
MD5 829978a4b443f1cb0a0622113c8f2a47
BLAKE2b-256 607d10cc2aea4fcc58a01d647c6a1d651c58fefb4be5dc4eb9cf9953a5ca180a

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