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

Uploaded Source

Built Distributions

pyqrack_cpu-1.32.20-py3-none-win_amd64.whl (687.9 kB view details)

Uploaded Python 3 Windows x86-64

pyqrack_cpu-1.32.20-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.20-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.20-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.20-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.20-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.20.tar.gz.

File metadata

  • Download URL: pyqrack_cpu-1.32.20.tar.gz
  • Upload date:
  • Size: 34.7 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.20.tar.gz
Algorithm Hash digest
SHA256 1d50fff3284879e912fadc9bc47a4adbd485569325fceec24dd27cf0e81aa03c
MD5 4832ad0ed91973075493a936c1d77c12
BLAKE2b-256 4f24c8b4dedff6b5a3f2a43e8e0c93faa13b0690ecd33907bbcb89d27a4372c3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack_cpu-1.32.20-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 2127e45d8c1941931868e7b592dd70d6f2d14f8cce43aaa088b673da03e2bdad
MD5 519a1e30152a2cbdcac64b36bb6986c3
BLAKE2b-256 d2d0cd9b54ae2d1c370a7b9da500ee53e47381708c78162bb619465d37bf5faa

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack_cpu-1.32.20-py3-none-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 db9fa019a0c7b2ac73bc0a757f8f3f2b1cc8b96444c5292d451e256edd9e429c
MD5 4c6ad14d7b9bb6dc68ad28d11e318ad5
BLAKE2b-256 3624cca96969c9368df7b88d59dec8568be97e4fcc91e038656e95b50308cf3c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack_cpu-1.32.20-py3-none-manylinux_2_35_x86_64.whl
Algorithm Hash digest
SHA256 46a52702091be87cb27d743baee09e1895299de981130e4e7cf90c48002e3fdd
MD5 8e8ef4701fd1fa19da3cc7397d203e1d
BLAKE2b-256 22dbca825db36baaa6b4261ad5508434152b229c6df588f66ca00befab3afa28

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack_cpu-1.32.20-py3-none-manylinux_2_31_x86_64.whl
Algorithm Hash digest
SHA256 d7c31f86d7369a4a6ffbe91892ec24607f5455ce4b33f21628c24e4dda62b6d3
MD5 f2ce89e65006636ced1db1e6ce430ef8
BLAKE2b-256 96b32f9d0d3da4566aa0f9b62cfdf1c23efc5d0f8b7f4172422669f484896fb5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack_cpu-1.32.20-py3-none-macosx_13_0_x86_64.whl
Algorithm Hash digest
SHA256 2d1ea0cdd49d309e2a54e1f18bda2825aa7ad0b52538008c29d3170efc9217ce
MD5 35e1808dfd03b5e8ec20258e273468e6
BLAKE2b-256 457bf0169ea4b902906625c76eeebed9bf00f11cc4e36d5811ebd6df81eb6a65

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack_cpu-1.32.20-py3-none-macosx_12_0_x86_64.whl
Algorithm Hash digest
SHA256 3a3c5af429d327d79788f47ce49715a83a7c88d6c2acab475ba95534801643c7
MD5 30a300a54c80040e2f6626b4e894cfe8
BLAKE2b-256 f47bb1fcc95552ee363672862002aab08777533a700e940c57cee3dc2b5d51e0

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