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
). 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, 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.33.1.tar.gz
.
File metadata
- Download URL: pyqrack-1.33.1.tar.gz
- Upload date:
- Size: 34.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 308d5de68506000394ff71cb51774c466988a38b5f0c9a346842584b3fb77786 |
|
MD5 | 308b1e6b3f74b008364de5b58bdf2a8c |
|
BLAKE2b-256 | 3e11519374de0a41e778edf219c7b2d6bb982a5b55d210630f28740f232889bb |
File details
Details for the file pyqrack-1.33.1-py3-none-win_amd64.whl
.
File metadata
- Download URL: pyqrack-1.33.1-py3-none-win_amd64.whl
- Upload date:
- Size: 858.1 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 | bc3dd3311cca9d5ceae3106fa30d926b5dde057222768b91f6a2911619ef7afe |
|
MD5 | 50049cb4f58256f57015d1a83e607193 |
|
BLAKE2b-256 | 98ed5108ecc4c6dcdb0ae4a3b8c04d0b954181a60816a3cbb0cbb5f8c3ff4760 |
File details
Details for the file pyqrack-1.33.1-py3-none-manylinux_2_39_x86_64.whl
.
File metadata
- Download URL: pyqrack-1.33.1-py3-none-manylinux_2_39_x86_64.whl
- Upload date:
- Size: 2.8 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 | 3f3916dc6fea027ef4926035dc724f6105414151e6826acc6433b10bc179689e |
|
MD5 | 874634d31ec0b01c58556e9a96496072 |
|
BLAKE2b-256 | 96c034441baa7679589dbc1745bef37e4ffdd6f82cc27102cc628134f2646591 |
File details
Details for the file pyqrack-1.33.1-py3-none-manylinux_2_35_x86_64.whl
.
File metadata
- Download URL: pyqrack-1.33.1-py3-none-manylinux_2_35_x86_64.whl
- Upload date:
- Size: 2.8 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 | 49c2865819629956fef225f9b0bdfe067a3bbe7bda963d20f869046e2862e70a |
|
MD5 | 8ba7abbeb0938f6afb85dfd01d38edf8 |
|
BLAKE2b-256 | 77808137852e1994ac9b942add68b79d0dba2fd6af8ebc7e372f0b94db853735 |
File details
Details for the file pyqrack-1.33.1-py3-none-manylinux_2_31_x86_64.whl
.
File metadata
- Download URL: pyqrack-1.33.1-py3-none-manylinux_2_31_x86_64.whl
- Upload date:
- Size: 2.7 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 | 7c9485dd4481150293e2c5272d69fb32f8484f11f17ca426634f882778cbffce |
|
MD5 | 26cf9df5bdddbcf132958ba4fa0765d5 |
|
BLAKE2b-256 | 24a7a4b907876fdc2da105420bda828546d1279b05daa093ecf76cd06c8e525d |
File details
Details for the file pyqrack-1.33.1-py3-none-macosx_15_0_arm64.whl
.
File metadata
- Download URL: pyqrack-1.33.1-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 | 7af4010965ba5d76ff14bd07d221ca4e3262cee23975add822dd6aa5bc8580a2 |
|
MD5 | 9a21ef2b479f19ece8b5263867326b4f |
|
BLAKE2b-256 | 2ce9f8223a2a40b0153bff9b241171b9550097c41a9c15dee9e911c6adb5282d |
File details
Details for the file pyqrack-1.33.1-py3-none-macosx_14_0_arm64.whl
.
File metadata
- Download URL: pyqrack-1.33.1-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 | 07e339c1a2abf244026a503ba62451b74951744bdad2707ee1706b1aa3f71c77 |
|
MD5 | 7959b6f755727aa30fa8bb722605e452 |
|
BLAKE2b-256 | ed8efcd98dca3f6b3c318bb19dcb51beec706c167a693b05b7a3ac7a56c6924a |
File details
Details for the file pyqrack-1.33.1-py3-none-macosx_13_0_x86_64.whl
.
File metadata
- Download URL: pyqrack-1.33.1-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 | 17ef765d6152dd89ac49680bf8f6f42986351126015d581da93ef427ef5ed8ca |
|
MD5 | b4e6e01464d62a86cee0cb86b103f20c |
|
BLAKE2b-256 | b1ba3e7d886791699b300ddf7b7bcb80529e599fb4c0c8b6d7be1a83a867e8d3 |