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.)
To use this package, it's helpful to be familiar with vm6502q/qrack. Users gain much more control over options by building vm6502q/qrack and vm6502q/pyqrack from source. For advanced users, building from source is the intended primary method of PyQrack package distribution and use.
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.
The package installation directory contains a qrack_cl_precompile
folder with executables for supported platforms, to compile OpenCL kernels once, beforehand, avoiding the need to recompile "just-in-time" every time that you load this package in a Python interpreter. If you no longer want to use precompiled kernels, or if precompilation fails, just delete the ~/.qrack
directory, or the equivalent .qrack
sub-directory in the user home folder of your operating system.
To load the required vm6502q/qrack libraries from a different location, set the PYQRACK_SHARED_LIB_PATH
environment variable. If an absolute path is set for this variable, it will be treated as an absolute path. If a relative path is used, the pyqrack package qrack_system
directory is the root.
PyQrack v0.4.6 adds 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.
Please feel welcome to open an issue, if you'd like help. 😃
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
Hashes for pyqrack-0.10.8-py3-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5a8635d66ee182f68bb078bde5ceaca0e068c61d21c0800ec6a8717236646987 |
|
MD5 | c9739adeec31c2f024ed1a39b2c6b3cd |
|
BLAKE2b-256 | a3f37cd163f555e5c24b7f9c924cf968f1fa820e54e76038c41e40b51dd187e2 |
Hashes for pyqrack-0.10.8-py3-none-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0eb98a78e8cf4059bf457c2bb7c879354c91cdb5ca729537f58592b59a82fc3e |
|
MD5 | d4e4c33d75237a0b988a708ed8bc1eb6 |
|
BLAKE2b-256 | c53187e2b63bc5d7ac1753519764fb97c0c395368cb4629c3009b0f350401c1f |
Hashes for pyqrack-0.10.8-py3-none-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b5a0bb39bbf06581332d1e57419ddf91a0e925d61db36b1b4b51b5b4e9eb43e3 |
|
MD5 | 302fbb25e4ab26bfaed340f8f8285c6d |
|
BLAKE2b-256 | 69791724be9f03450309bbb5e2d529dc72bf138729c69b5c1bc49b37b9853352 |
Hashes for pyqrack-0.10.8-py3-none-macosx_10_4_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 329b2567fcfa0043088dda5a64959d2c50a90a03843dd1aa2aeb19b5773ec099 |
|
MD5 | c1cac08c6ca30cfad2ad85c8654b4723 |
|
BLAKE2b-256 | 784cd94ffa7313d202fd840505e52cf6a46b3571abd560ae4934e01cfd374105 |
Hashes for pyqrack-0.10.8-py3-none-linux_armv7l.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bcf82fad5be3d06578944244f4700abdc4fca2bd90f52c71567c2ed863033daa |
|
MD5 | ff68feb7313fa6a857fd8dabd39f8cc5 |
|
BLAKE2b-256 | 88262919906513cfae4546234f8f698879bc1af7ab60f2479555974af297e1c1 |