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

Uploaded Source

Built Distributions

pyqrack-1.32.31-py3-none-win_amd64.whl (867.9 kB view details)

Uploaded Python 3 Windows x86-64

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

Uploaded Python 3 macOS 15.0+ ARM64

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

Uploaded Python 3 macOS 14.0+ ARM64

pyqrack-1.32.31-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.31.tar.gz.

File metadata

  • Download URL: pyqrack-1.32.31.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.31.tar.gz
Algorithm Hash digest
SHA256 99b28e61cfbae0af9cbe8fce4b377b518d728381519e21a8df1df368db42fa5f
MD5 7fbbb8bab88285e2dc32261f3e3af6c9
BLAKE2b-256 cee5c0cef0712be30e627ffde1fba77ea25db61c507fbd3a207e8f4e3f5a4e0f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pyqrack-1.32.31-py3-none-win_amd64.whl
  • Upload date:
  • Size: 867.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.31-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 ad4521df8fd641d90f2e4ecf4adb449fb560ba852060fafac90bc78f6db8ae28
MD5 6994124ab593215ce60d6b6244ae5621
BLAKE2b-256 b32073b4d764bc0a290e28e335ce4e5195d889a6a85073851aefdef13c700bd7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack-1.32.31-py3-none-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 8ed5c5c80aa79798cb26d7234eadb89ec3fc0caef992c43e6e503fc69d1661d2
MD5 5425f00c55275c17f128fc05c7dfb20b
BLAKE2b-256 c1cc8ba0663320704d30ffcccaccf78df5bb14fa9103f88ac0276a05194798c6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack-1.32.31-py3-none-manylinux_2_35_x86_64.whl
Algorithm Hash digest
SHA256 b7a95ff61dd1b0907e5a7995f88fd52f50b548c5f6dfc9d2d699e1c83f034ed8
MD5 e3c03986bbeb1a22f6d1db8e05057265
BLAKE2b-256 0b245f39f6feb72fe0c992f47c72cf3eec1348c91473eeea9abd24be80e2f52a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack-1.32.31-py3-none-manylinux_2_31_x86_64.whl
Algorithm Hash digest
SHA256 f24c394054fa9eecdae02f96ba0052843dbf47e0654f287bf4eb57827d04e6b5
MD5 1e4ecd2584d18cf789b9053191741f4b
BLAKE2b-256 f946715beb9bdfd307d7e3692294f410af6c17510bd2f54e6fa4116096e63730

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack-1.32.31-py3-none-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 8bdb6ec6c83face4ef1a147889f0aef4b0a4738e799d9d33d7329e94ec26c60d
MD5 b6024bcf3a205f698feb3c5d7b3a5730
BLAKE2b-256 551d3dd879e972bed1fae7768c976da7af90ed60c5c06b54ec43623b462bfd28

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack-1.32.31-py3-none-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 adc09db68a27fa9bee2437d2828ffb9f9186034ff7f1c60a57b4e3e92db5cc49
MD5 9b4f041d34dd95c4c53720b7ccad3d60
BLAKE2b-256 0ee7225a5a56ca0c46447febc69a74f424acb48d96d95f48318c2efbd132e8e0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack-1.32.31-py3-none-macosx_13_0_x86_64.whl
Algorithm Hash digest
SHA256 875b8b5177481e7e550d375ca71d9a3a5ceb811f93935cf5f9e59a3d7d2683cc
MD5 e182059e7ac77a294199e69ddd14e2ef
BLAKE2b-256 dc4e3dafc4d3726a07a3ab083e4f5637d83fce1de1e73672c531def13ac4ab8e

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