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

Uploaded Source

Built Distributions

pyqrack-1.32.16-py3-none-win_amd64.whl (868.1 kB view details)

Uploaded Python 3 Windows x86-64

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

Uploaded Python 3 macOS 15.0+ ARM64

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

Uploaded Python 3 macOS 14.0+ ARM64

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

Uploaded Python 3 macOS 13.0+ x86-64

pyqrack-1.32.16-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.16.tar.gz.

File metadata

  • Download URL: pyqrack-1.32.16.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.16.tar.gz
Algorithm Hash digest
SHA256 6aafcff17b97f362845a1537d03cc3184b8a76af1d0dc55041df6045f0bbabc4
MD5 690aab41ecca99d00a87203dc1e6e262
BLAKE2b-256 12455df7d9f211157cc19519a241cd60caa2928b642fd80a0563dc452a330ab5

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pyqrack-1.32.16-py3-none-win_amd64.whl
  • Upload date:
  • Size: 868.1 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.16-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 5426c760c0d09633542f2e18b67041512e2bbf38dbf4d990e383502c3490939a
MD5 ae8402d614be85fe9a453dafb4192094
BLAKE2b-256 6f1460d3faa9a985a83ed704224dc8c8fae6e3a70a16c7a04242f41c9849e8d7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack-1.32.16-py3-none-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 25956465055f11a1fe268be55d3bc3ac6d42ee4b5d6b460d66fda0d955e564d2
MD5 daf7dfa02a550e380e6b24b2986f7830
BLAKE2b-256 482581f2a863bfb8b3c51f1f4ef89032425b0fc1ca89443f588a5a9005540453

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack-1.32.16-py3-none-manylinux_2_35_x86_64.whl
Algorithm Hash digest
SHA256 80d86a8d3e04c568442657d0f8f12b10bd724da0a88f94be40c7dc0f561d4ce3
MD5 ba4e8b06df61dd31bf4858a9df5baea2
BLAKE2b-256 17a5eedba9a3e7ad8fdbb349a35b2f115cf23051a4e80bd748aeb2caffa41901

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack-1.32.16-py3-none-manylinux_2_31_x86_64.whl
Algorithm Hash digest
SHA256 917433321c6090fbeb5e7d5abb288794181e004adca0a36cd09345bb6ec2d12e
MD5 638cc381b402e2af9f411843b265c763
BLAKE2b-256 4ee27f45293c5c4bdc75d97524f04412f998240184a2f29081fb5b8dd2fa9a86

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack-1.32.16-py3-none-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 feecdaa39457200cf03bc7783f0905a4b4aa5e736c5fbd845d73a943a7f0d646
MD5 7007c016a0cf0eb33dce1b45eb7610bc
BLAKE2b-256 504dd82bcf08b6d48f8e9c7f63cff3134c58d103a9e791b909aaadfad3d8fc6c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack-1.32.16-py3-none-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 f6291253c15c575aca8715eff14faee5ea612604d32628f5e63fe281f7820a8c
MD5 3c8d61bc67a2103bbd3a8147a854a85c
BLAKE2b-256 2fcd926a75ed278e5dde02c5399c1bbef685daa0095487b74e961d2031afca27

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack-1.32.16-py3-none-macosx_13_0_x86_64.whl
Algorithm Hash digest
SHA256 57f8de9b9ef728caf146e85437d7fe37736ead3624acb58050f338c9ec2ffa02
MD5 be5a2a378329a74f02c0115ec6e2524a
BLAKE2b-256 90ef8156f39170aa8a8ad69251d7d083f3f8901be51bf526fd1f320dde13f988

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack-1.32.16-py3-none-macosx_12_0_x86_64.whl
Algorithm Hash digest
SHA256 0d1aedd0b6710a1fe723f7c74ca6429ad0a5d6b2760b7946d2888694d7bf58ed
MD5 e159d9494352022dce01f7506755f179
BLAKE2b-256 7db3f3cf1d1e21c4b9b6d2945fd0945981e0cb032c1513b2be261f374009cecb

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