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). 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

pyqrack-1.32.25.tar.gz (34.1 kB view details)

Uploaded Source

Built Distributions

pyqrack-1.32.25-py3-none-win_amd64.whl (867.7 kB view details)

Uploaded Python 3 Windows x86-64

pyqrack-1.32.25-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.25-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.25-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.25-py3-none-macosx_15_0_arm64.whl (1.6 MB view details)

Uploaded Python 3 macOS 15.0+ ARM64

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

Uploaded Python 3 macOS 14.0+ ARM64

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

Uploaded Python 3 macOS 13.0+ x86-64

File details

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

File metadata

  • Download URL: pyqrack-1.32.25.tar.gz
  • Upload date:
  • Size: 34.1 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.25.tar.gz
Algorithm Hash digest
SHA256 da5a46ec799e49807b024025232058a873403070d945dd15af28ca7bc71781f5
MD5 10bd4d0275793332dea4a5d14724c869
BLAKE2b-256 63226f1f9952f406a3ce12f75b451f89444a8275876b1b0eb1e08067133a999f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pyqrack-1.32.25-py3-none-win_amd64.whl
  • Upload date:
  • Size: 867.7 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.25-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 7ace8f2fe86626a7aeb662f2ff9a6086ba8f58eaec45d1dd63ab77f45a7be2de
MD5 ed3fa1209299b1b17b1285d86308572c
BLAKE2b-256 e7c329a0c2ca7a0762c10ab9fa1c249a2771ffd6f1f4cda6d655d30095cc60a0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack-1.32.25-py3-none-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 2080c580ba451f43e4d0ad541e1e66e08ce1f5f13e9cebf7151b67466747822c
MD5 df68afeb874801c8d488ba0df510dec3
BLAKE2b-256 172f20521d1e48596e0c28ce2a085a2dd4361d64bff7f817c6314ade6c2d48f2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack-1.32.25-py3-none-manylinux_2_35_x86_64.whl
Algorithm Hash digest
SHA256 91f134f62ee6b8a293c1affd8b77a717d7480c902af84451d9b320f0aab9fd88
MD5 98cb244be1a34f6d3db0fd347806f32a
BLAKE2b-256 091293eed6da90074d8decd6439fca0ed0a2ff352c221673707504eb734e8df4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack-1.32.25-py3-none-manylinux_2_31_x86_64.whl
Algorithm Hash digest
SHA256 0462acfce1215cb754c370dee6cd52f2caa58e7d1271c7ff041e85c91361b661
MD5 2a9e92a8641677c8541aa57caa369ac1
BLAKE2b-256 44e80782f6af2c530e200a142e83769ab34c519c12d8a56968927ffcb1e89d0a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack-1.32.25-py3-none-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 81a31328420479d35c8eb3ea768134bc3f582fc47c91371a9387f8cf22887a4b
MD5 db56d5ae8c0f9e68ae0e8926903a9a2e
BLAKE2b-256 8ca3ddcfbbb5cd8bc118e849cca9ee01db55aacda704f8a6fa93909aea132e64

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack-1.32.25-py3-none-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 aa28a445b5b60e3cd5499b11f73b1934b66f6dededc82f5e8384700018b4ad4b
MD5 b70ac62186096415e2628ed91c00a4f4
BLAKE2b-256 f778acf9a7c296364f15e6d972e5e3c35e3aa6c25cb0a1ad58005c3e48b74365

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack-1.32.25-py3-none-macosx_13_0_x86_64.whl
Algorithm Hash digest
SHA256 12db0cb3b9924518854f8fed59bff742b10240921a3964e6941b4c688441252d
MD5 219043ec6c481570fcd7708d83541b73
BLAKE2b-256 53bb5ba34134e962e73a8a2617f8f5ce7d4c4078744bd71b862b12fba60d547c

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