Skip to main content

pyqrack - Pure Python vm6502q/qrack Wrapper

Project description

pyqrack

Downloads Downloads Downloads

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

pyqrack-1.32.13.tar.gz (33.6 kB view details)

Uploaded Source

Built Distributions

pyqrack-1.32.13-py3-none-win_amd64.whl (871.3 kB view details)

Uploaded Python 3 Windows x86-64

pyqrack-1.32.13-py3-none-manylinux_2_39_x86_64.whl (2.7 MB view details)

Uploaded Python 3 manylinux: glibc 2.39+ x86-64

pyqrack-1.32.13-py3-none-manylinux_2_35_x86_64.whl (2.7 MB view details)

Uploaded Python 3 manylinux: glibc 2.35+ x86-64

pyqrack-1.32.13-py3-none-manylinux_2_31_x86_64.whl (2.7 MB view details)

Uploaded Python 3 manylinux: glibc 2.31+ x86-64

pyqrack-1.32.13-py3-none-macosx_15_0_arm64.whl (1.6 MB view details)

Uploaded Python 3 macOS 15.0+ ARM64

pyqrack-1.32.13-py3-none-macosx_14_0_arm64.whl (1.5 MB view details)

Uploaded Python 3 macOS 14.0+ ARM64

pyqrack-1.32.13-py3-none-macosx_13_0_x86_64.whl (2.2 MB view details)

Uploaded Python 3 macOS 13.0+ x86-64

pyqrack-1.32.13-py3-none-macosx_12_0_x86_64.whl (2.1 MB view details)

Uploaded Python 3 macOS 12.0+ x86-64

File details

Details for the file pyqrack-1.32.13.tar.gz.

File metadata

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

File hashes

Hashes for pyqrack-1.32.13.tar.gz
Algorithm Hash digest
SHA256 0b461392680d9862e3d3fb4db3935fef153483d2a5f40131fe75210589b1c664
MD5 35c516e47913ed2a13dad9abd307d6dd
BLAKE2b-256 a2afb7f5ac0e69ac055533b0d27be27cd9d659f97b151b468309b51d6e71c715

See more details on using hashes here.

File details

Details for the file pyqrack-1.32.13-py3-none-win_amd64.whl.

File metadata

  • Download URL: pyqrack-1.32.13-py3-none-win_amd64.whl
  • Upload date:
  • Size: 871.3 kB
  • Tags: Python 3, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for pyqrack-1.32.13-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 b7b9b30c542f74f93a2f8423e828506b0348c34f017bcc0acb60548f375c82eb
MD5 fb1df12b514b7d90adcf9d495267d5a7
BLAKE2b-256 d30c801262d732317c657c96eb7a431c6d24959167f8923ef684030d2d344ddb

See more details on using hashes here.

File details

Details for the file pyqrack-1.32.13-py3-none-manylinux_2_39_x86_64.whl.

File metadata

File hashes

Hashes for pyqrack-1.32.13-py3-none-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 089c6ae9c5884785e4e3f11988cc41c753c1471ad9910aec4fe32ebe86e36c65
MD5 e28ef5fca227420b23fa22899aec4884
BLAKE2b-256 b8cfb3be26948dc31fe7a410dba88e5491cf879da7c441077d435d90b01cf3e7

See more details on using hashes here.

File details

Details for the file pyqrack-1.32.13-py3-none-manylinux_2_35_x86_64.whl.

File metadata

File hashes

Hashes for pyqrack-1.32.13-py3-none-manylinux_2_35_x86_64.whl
Algorithm Hash digest
SHA256 68f8785170cef2883ec8b1a61a257c521a9ff3be68c099d930b91e68e6439a3e
MD5 83035900389bfc363a5e39c314ede6f2
BLAKE2b-256 4b79a6f4a26f02205428b03767b3ee9049d53a3901ffb470735e19ddc87c6c87

See more details on using hashes here.

File details

Details for the file pyqrack-1.32.13-py3-none-manylinux_2_31_x86_64.whl.

File metadata

File hashes

Hashes for pyqrack-1.32.13-py3-none-manylinux_2_31_x86_64.whl
Algorithm Hash digest
SHA256 0da41c48df10bc29aa08953702676f1f1b746cccc695323af8bf0c06b0af42d4
MD5 fb1391b3837c3f6608223d70deae8a0b
BLAKE2b-256 7f0274d109d6ee8db717c7a628645d919d91a9cd7386cd16a12966a324354e8e

See more details on using hashes here.

File details

Details for the file pyqrack-1.32.13-py3-none-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for pyqrack-1.32.13-py3-none-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 02c1186f9a5a1b30846259438164a3d4efc12f57fb0b3f24e75bcb34a9106b9e
MD5 b75a1150ca9696afe1ee0af77102ddb5
BLAKE2b-256 52271a0f373bfca188d5a3f693c2b9cd64503f982b8f911ce454fbd02fe27704

See more details on using hashes here.

File details

Details for the file pyqrack-1.32.13-py3-none-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for pyqrack-1.32.13-py3-none-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 cc5b8ebf541d3e534b01c92f756d067ffd131f18d019901412591c68826bcc78
MD5 05e1abc9dd0490d60be2551f0f7ab478
BLAKE2b-256 7c4b61f0f612721a00df19b999dcaf93fd1632f927e4540023ffd9249fe5fbb5

See more details on using hashes here.

File details

Details for the file pyqrack-1.32.13-py3-none-macosx_13_0_x86_64.whl.

File metadata

File hashes

Hashes for pyqrack-1.32.13-py3-none-macosx_13_0_x86_64.whl
Algorithm Hash digest
SHA256 3a92f09e36d793bafd99be9e1ef0b8bd1dcdee775078a44b6352bb40610a3fd9
MD5 5c5dd2d0011e94961a1d4b1d02e92c99
BLAKE2b-256 fc876faa5da5300108727b7281ab62e792bab0f8a976fc7940d4a6c42b878899

See more details on using hashes here.

File details

Details for the file pyqrack-1.32.13-py3-none-macosx_12_0_x86_64.whl.

File metadata

File hashes

Hashes for pyqrack-1.32.13-py3-none-macosx_12_0_x86_64.whl
Algorithm Hash digest
SHA256 4ec2415e6172aa04c3e41d5f340f35870bb63e5aaaf0cc354e7ee60c5881eb85
MD5 2a72727e271df079888d65e1dbb23ef8
BLAKE2b-256 73a27486f281da31c935c9d48efed4c5b202e8fd96ca5249138d308f2d9085fd

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