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

Uploaded Source

Built Distributions

pyqrack-1.32.28-py3-none-win_amd64.whl (868.9 kB view details)

Uploaded Python 3 Windows x86-64

pyqrack-1.32.28-py3-none-manylinux_2_39_x86_64.whl (2.8 MB view details)

Uploaded Python 3 manylinux: glibc 2.39+ x86-64

pyqrack-1.32.28-py3-none-manylinux_2_35_x86_64.whl (2.8 MB view details)

Uploaded Python 3 manylinux: glibc 2.35+ x86-64

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

Uploaded Python 3 macOS 15.0+ ARM64

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

Uploaded Python 3 macOS 14.0+ ARM64

pyqrack-1.32.28-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.28.tar.gz.

File metadata

  • Download URL: pyqrack-1.32.28.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.28.tar.gz
Algorithm Hash digest
SHA256 66c73ac8011e2629991505b6eb41f4fc2f0156146e98bf81f16596ff07b860ef
MD5 6b507f4bbd15061dc4b3e3060a8a2d57
BLAKE2b-256 e101941b075496ff56d6f30ed8f18801d5c7a23827829e0dc75e46f3fff39081

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pyqrack-1.32.28-py3-none-win_amd64.whl
  • Upload date:
  • Size: 868.9 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.28-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 63305fb63064bc514a4da37c88727bc681855fce59127915b4c97443e540e564
MD5 244e3ee36fbe4d9e93db0452cab91a14
BLAKE2b-256 7b6dee8f63666ec4941c7e80c089d592bf26dfc37bf0a214c71ee3bd7b54b5bc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack-1.32.28-py3-none-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 2a9cf3f24a32e984343258c99c34452a9d65a9f86168c1aede71b801b177963c
MD5 e5397fab83cdd359a90c507c215bee11
BLAKE2b-256 acd0570d9fb6f12f61cf27c8c48bc4c04c5cd064744bc61b8358e03f22c37e74

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack-1.32.28-py3-none-manylinux_2_35_x86_64.whl
Algorithm Hash digest
SHA256 704dccdec3423e1040239d80862dd50a7d6a93a9bf55968d5b626ef55220bd74
MD5 d086dda596a8fce38108304afcbd4f06
BLAKE2b-256 da77b82fa1b9c07d2e17bcb17cad602c08ca9d7aa6081056848558514fa81bd1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack-1.32.28-py3-none-manylinux_2_31_x86_64.whl
Algorithm Hash digest
SHA256 1954d6552fec15e81cdefb2f43a83fee515990d3338bbbcec6406c0481a0b1bf
MD5 6cf6a4e1bfeff261b3cd8bc6e17dde79
BLAKE2b-256 99736db599bebb665e1c8b93466fd7464725659621157a435c74f622b48b93c4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack-1.32.28-py3-none-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 b679c0b6e431ca546e67b7d4cbd34a81daae42acba65de41aedef8dec2bc3966
MD5 969c2feba95f762899b590edce104cc8
BLAKE2b-256 3767a40283062dcca178031c732b6f87e148f7c16e77afefe60e76714738541c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack-1.32.28-py3-none-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 1f715746e2c299f7b2f86ab8e975bf30e2e9247b38aef9e0447c29e759d913a0
MD5 a38a7b0592db625e9ef8c4869d5db375
BLAKE2b-256 3c719f063776188a084fd02d7c13ca20b5ecb0de0e694fe95e637daa36bb7bcd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack-1.32.28-py3-none-macosx_13_0_x86_64.whl
Algorithm Hash digest
SHA256 4f34f8a63f837582ff92a10de97121bdc66add5b57f124fc7760f87452068bfd
MD5 e83f4c445b7d8613514c7c75d6f49c04
BLAKE2b-256 88bb6cbfb573814b800c1c1432ed36fc70085e38852a22a7a260fbe4b957138b

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