Skip to main content

pyqrack - Pure Python vm6502q/qrack Wrapper

Project description

pyqrack

Downloads Downloads Downloads

Pure Python bindings for the pure C++11 Qrack quantum computer simulator library

(PyQrack is just pure Qrack.)

<<<<<<< HEAD This is the purely CPU-based variant of PyQrack (with module name pyqrack-cpu). This alternate build of PyQrack is provided so that systems that won't use OpenCL anyway (such as because they lack any GPUs or other accelerators like the Intel HD) do not need to install the OpenCL library in order to use PyQrack. In this form, both the PyQrack module and the underlying C++ Qrack library are entirely external dependency-free.

(If you installing from source, it doesn't matter whether you use pyqrack or pyqrack-cpu, because the build version of C++ Qrack you intend to use must already be installed locally.)

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.

main

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyqrack_cpu-1.32.19.tar.gz (34.3 kB view details)

Uploaded Source

Built Distributions

pyqrack_cpu-1.32.19-py3-none-win_amd64.whl (688.9 kB view details)

Uploaded Python 3 Windows x86-64

pyqrack_cpu-1.32.19-py3-none-manylinux_2_39_x86_64.whl (2.2 MB view details)

Uploaded Python 3 manylinux: glibc 2.39+ x86-64

pyqrack_cpu-1.32.19-py3-none-manylinux_2_35_x86_64.whl (2.2 MB view details)

Uploaded Python 3 manylinux: glibc 2.35+ x86-64

pyqrack_cpu-1.32.19-py3-none-manylinux_2_31_x86_64.whl (2.1 MB view details)

Uploaded Python 3 manylinux: glibc 2.31+ x86-64

pyqrack_cpu-1.32.19-py3-none-macosx_13_0_x86_64.whl (1.7 MB view details)

Uploaded Python 3 macOS 13.0+ x86-64

pyqrack_cpu-1.32.19-py3-none-macosx_12_0_x86_64.whl (1.6 MB view details)

Uploaded Python 3 macOS 12.0+ x86-64

File details

Details for the file pyqrack_cpu-1.32.19.tar.gz.

File metadata

  • Download URL: pyqrack_cpu-1.32.19.tar.gz
  • Upload date:
  • Size: 34.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for pyqrack_cpu-1.32.19.tar.gz
Algorithm Hash digest
SHA256 1f6fa19f3b6b2bbbc4951c4a39dca62375ebbbef735006545a04741c881dd0ba
MD5 3bd027e6086b3f07890f6bec1543ab2b
BLAKE2b-256 9f425741022dd09b2c199d253af10a6cccc5aa2f0dec1238330384a91192c001

See more details on using hashes here.

File details

Details for the file pyqrack_cpu-1.32.19-py3-none-win_amd64.whl.

File metadata

File hashes

Hashes for pyqrack_cpu-1.32.19-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 15937601717e062cd8668a683f97720d95d8312599fade2e173410c5d9b35b4e
MD5 43da2f73e04f386f0ed7830c160386bb
BLAKE2b-256 67ee3cef2e06eb2822b3f7688328beee30a1803e3290554c8153d2d9ae87470d

See more details on using hashes here.

File details

Details for the file pyqrack_cpu-1.32.19-py3-none-manylinux_2_39_x86_64.whl.

File metadata

File hashes

Hashes for pyqrack_cpu-1.32.19-py3-none-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 585519e66464f04e598712c849621cae1268ae5dadf8f3fe17052ccd5b34ead1
MD5 099ada1fbbfb78f8cde97422efa0fd96
BLAKE2b-256 2db6bb1c03bf19cf923d04140a3c34064cfae6e337a89ea445cc3627112bf6ea

See more details on using hashes here.

File details

Details for the file pyqrack_cpu-1.32.19-py3-none-manylinux_2_35_x86_64.whl.

File metadata

File hashes

Hashes for pyqrack_cpu-1.32.19-py3-none-manylinux_2_35_x86_64.whl
Algorithm Hash digest
SHA256 ea7c7941f4e658308849ff5b219adbb7a5ba2e71261ce6949e168f888bf15f7f
MD5 2319ea5325c9cb8cf3f5c6255f0ad350
BLAKE2b-256 e0f59b3f487dc036ddd4772fc2ffe0186d6f5da661fdead86b32f7de47282e9f

See more details on using hashes here.

File details

Details for the file pyqrack_cpu-1.32.19-py3-none-manylinux_2_31_x86_64.whl.

File metadata

File hashes

Hashes for pyqrack_cpu-1.32.19-py3-none-manylinux_2_31_x86_64.whl
Algorithm Hash digest
SHA256 1e845ee21a8b2c1b5849937f6d58d2536ec753a7086fc5c28bd2e4ddbacd81ac
MD5 616c73df334f1520e0783f4513449552
BLAKE2b-256 9fffbf585df36b5963d9e603920f5c0cdf8b8c2e648f3357b22397ea1fb17096

See more details on using hashes here.

File details

Details for the file pyqrack_cpu-1.32.19-py3-none-macosx_13_0_x86_64.whl.

File metadata

File hashes

Hashes for pyqrack_cpu-1.32.19-py3-none-macosx_13_0_x86_64.whl
Algorithm Hash digest
SHA256 f01b5c80995d598ca0020caf589554c265d715c953f216955dca5299b62bbff7
MD5 aed068374595ea49fe98c20e7a7f3304
BLAKE2b-256 e8ba42e0449275f040d481381640d58b76de8156793d28ac218725ade4566281

See more details on using hashes here.

File details

Details for the file pyqrack_cpu-1.32.19-py3-none-macosx_12_0_x86_64.whl.

File metadata

File hashes

Hashes for pyqrack_cpu-1.32.19-py3-none-macosx_12_0_x86_64.whl
Algorithm Hash digest
SHA256 4a8343f45e3f69752499ad840230f262ff6350c3157cdfd0ae9670ba3ee9a0f4
MD5 72c014bf10982b83775d2fcd29e4b31c
BLAKE2b-256 21aebe654b1bf135629b9a7b0e64d9b3882b2dbad9cb7cd5f98778719ede5414

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page