pyqrack - Pure Python vm6502q/qrack Wrapper
Project description
pyqrack
Pure Python bindings for the pure C++11/OpenCL Qrack quantum computer simulator library
(PyQrack is just pure Qrack.)
Note, if building from source: You must build and install unitaryfund/qrack to build the main
branch from source. CI/CD builds wheels that contain pre-compiled Qrack binaries, and that is the form published on PyPi. You must also install OpenCL.
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
).
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, 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
Built Distributions
File details
Details for the file pyqrack-1.32.9.tar.gz
.
File metadata
- Download URL: pyqrack-1.32.9.tar.gz
- Upload date:
- Size: 33.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a99d8c960842b35469e0cec111bc02e0c5ab9c640b703ddae10bf9e2a72cd066 |
|
MD5 | 7ff5897899d724bd5babdc2f0e17ebb6 |
|
BLAKE2b-256 | 2baa3f49f69429efe2bbcf9ad96ac8517abaaa144e123cce281b25042509f2d4 |
File details
Details for the file pyqrack-1.32.9-py3-none-win_amd64.whl
.
File metadata
- Download URL: pyqrack-1.32.9-py3-none-win_amd64.whl
- Upload date:
- Size: 860.0 kB
- Tags: Python 3, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 514a26cdd3159ed8bef76d67bfe1371c6475793704ee9f6edd96a1257274762f |
|
MD5 | a63a3622e3679be9a4f5e68742f08664 |
|
BLAKE2b-256 | ea6f65c14af134e4453b73cb7597e24b5b6298599341cc17c07b6fc24409356c |
File details
Details for the file pyqrack-1.32.9-py3-none-manylinux_2_39_x86_64.whl
.
File metadata
- Download URL: pyqrack-1.32.9-py3-none-manylinux_2_39_x86_64.whl
- Upload date:
- Size: 2.7 MB
- Tags: Python 3, manylinux: glibc 2.39+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c9705d000739ee628844bf751c8bafbe958e4eaafb13f8be7c32ab67d9da47fd |
|
MD5 | c1860f2adee476502ecaf30b02b02229 |
|
BLAKE2b-256 | 861c93e8f0f4981b18d0e11ac5c3f96f10e65d754c972c3cff8f49308e00d39b |
File details
Details for the file pyqrack-1.32.9-py3-none-manylinux_2_35_x86_64.whl
.
File metadata
- Download URL: pyqrack-1.32.9-py3-none-manylinux_2_35_x86_64.whl
- Upload date:
- Size: 2.7 MB
- Tags: Python 3, manylinux: glibc 2.35+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 765d21c6228e786ef5360a4adb03767125c650aa84a796f607135dab27d87c55 |
|
MD5 | c435d4c67887951940836219aaabc0d2 |
|
BLAKE2b-256 | 1f31463b000bd068d41db3eaab59b9931cef741dd939ff44c8b472282617af0d |
File details
Details for the file pyqrack-1.32.9-py3-none-manylinux_2_31_x86_64.whl
.
File metadata
- Download URL: pyqrack-1.32.9-py3-none-manylinux_2_31_x86_64.whl
- Upload date:
- Size: 2.6 MB
- Tags: Python 3, manylinux: glibc 2.31+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 53a52e04a187d3236165c44f4e071391394995e6626c3a12af981dfcf4f233fd |
|
MD5 | c35528d29f4be958a2a83aded47fd811 |
|
BLAKE2b-256 | 9434a3b5d4a2ea5d137add9695ed908ca2decedadeddb0f8516e8ce7446b94ae |
File details
Details for the file pyqrack-1.32.9-py3-none-macosx_15_0_arm64.whl
.
File metadata
- Download URL: pyqrack-1.32.9-py3-none-macosx_15_0_arm64.whl
- Upload date:
- Size: 1.5 MB
- Tags: Python 3, macOS 15.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cc78b4a5f0845f560bdab462792489d02462044e423df48b4c71ad4a19038555 |
|
MD5 | 41ae948cfab85a88f8c0f6db41a8580b |
|
BLAKE2b-256 | 21639f6636824b17e4a8a8339cf0f33557e28fa03ef00d6479a345ec9fe3d896 |
File details
Details for the file pyqrack-1.32.9-py3-none-macosx_14_0_arm64.whl
.
File metadata
- Download URL: pyqrack-1.32.9-py3-none-macosx_14_0_arm64.whl
- Upload date:
- Size: 1.5 MB
- Tags: Python 3, macOS 14.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0bad1b0ac56af4e2006a08d06e013278dacc293d420f4910b401b4110dd646e6 |
|
MD5 | a08dbe377a3ffffedcada4873dfea5b2 |
|
BLAKE2b-256 | edd2e221710acfce42383c031984650318301d47f9f3832fd6cac33a9cc3e0fe |
File details
Details for the file pyqrack-1.32.9-py3-none-macosx_13_0_x86_64.whl
.
File metadata
- Download URL: pyqrack-1.32.9-py3-none-macosx_13_0_x86_64.whl
- Upload date:
- Size: 2.1 MB
- Tags: Python 3, macOS 13.0+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 72eed7ccbced942ba59cdb23a3ee7f386b0e2d2e17d2f30c5623016605ae9327 |
|
MD5 | 70e8af9a9c03bac07ca520df2e5da8e6 |
|
BLAKE2b-256 | 323253d102649c0976efe99c6da20855fc7f0a21f2f60a8d51650322bc5d5900 |
File details
Details for the file pyqrack-1.32.9-py3-none-macosx_12_0_x86_64.whl
.
File metadata
- Download URL: pyqrack-1.32.9-py3-none-macosx_12_0_x86_64.whl
- Upload date:
- Size: 2.1 MB
- Tags: Python 3, macOS 12.0+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7ef095ddb26c3d9a05671cde00ad54b187c5c6e8e03dd52173213bea1f09b7f3 |
|
MD5 | 7f96b715919d6368ea954d709e1b3500 |
|
BLAKE2b-256 | a836021f148074e2e0e7206a042e19d21b1be03cfc24c8d0f24c8c53bc38fde4 |