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: You must also install OpenCL to use this version of Qrack. (There are also CPU-only and CUDA version.)

If you're looking for Mac ARM support, use the package pyqrack, not pyqrack-cpu. Mac officially "deprecated" OpenCL years ago. Hence, accelerator support is not included in ARM-based Mac wheels, and OpenCL installation is not required on these systems, but, if you have a CUDA accelerator on ARM-based Mac, you could try the package pyqrack-cuda instead.

Performance can benefit greatly from following the Qrack repository "Quick Start" and "Power user considerations."

If you use an integrated graphics accelerator, like the Intel HD, setting environment variable PYQRACK_HOST_POINTER_DEFAULT_ON=1 (or to any "truthy" value) will automatically set the default of isHostPointer option of QrackSimulator to True, to engage "zero-copy" mode by default.

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, Or Golan, for CI build pipeline tooling, 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_complex128-2.1.0.tar.gz (56.1 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

pyqrack_complex128-2.1.0-py3-none-win_amd64.whl (1.0 MB view details)

Uploaded Python 3Windows x86-64

pyqrack_complex128-2.1.0-py3-none-manylinux_2_39_x86_64.whl (3.7 MB view details)

Uploaded Python 3manylinux: glibc 2.39+ x86-64

pyqrack_complex128-2.1.0-py3-none-manylinux_2_35_x86_64.whl (3.7 MB view details)

Uploaded Python 3manylinux: glibc 2.35+ x86-64

pyqrack_complex128-2.1.0-py3-none-macosx_15_0_x86_64.whl (2.1 MB view details)

Uploaded Python 3macOS 15.0+ x86-64

pyqrack_complex128-2.1.0-py3-none-macosx_15_0_arm64.whl (1.9 MB view details)

Uploaded Python 3macOS 15.0+ ARM64

pyqrack_complex128-2.1.0-py3-none-macosx_14_0_arm64.whl (1.9 MB view details)

Uploaded Python 3macOS 14.0+ ARM64

File details

Details for the file pyqrack_complex128-2.1.0.tar.gz.

File metadata

  • Download URL: pyqrack_complex128-2.1.0.tar.gz
  • Upload date:
  • Size: 56.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for pyqrack_complex128-2.1.0.tar.gz
Algorithm Hash digest
SHA256 c66ce4c3607c5126b3a90c474fb4b7dd97ca62f1e186361f7a7b51a07e75c542
MD5 b8dd1e541c9a6669be7318bcc93672cb
BLAKE2b-256 8280d41d6c023b794d2484570510145089fc2d596b4a0b8485a4b82c5e80e0bf

See more details on using hashes here.

File details

Details for the file pyqrack_complex128-2.1.0-py3-none-win_amd64.whl.

File metadata

File hashes

Hashes for pyqrack_complex128-2.1.0-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 53a222a472b6f2c7dd031b8f1ce8cd875adf53f717dab8dff1486e31215225be
MD5 43a76177695555281ee5f8f5ec4eccb1
BLAKE2b-256 f91d4001185d2c4415ff7fbb970e84a867785820d63b2b5735923136a5afaf1e

See more details on using hashes here.

File details

Details for the file pyqrack_complex128-2.1.0-py3-none-manylinux_2_39_x86_64.whl.

File metadata

File hashes

Hashes for pyqrack_complex128-2.1.0-py3-none-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 c9599e15fca80de5c2c31442de2c66ab9c2e80a4e59fd8665b7272d5ef49ed4b
MD5 5f60610be657b1d3b406164efa31fa52
BLAKE2b-256 f61176fc0b18c0e72f7c51a80ce6e10eba42b2852317f607b34e9a66d97fff1f

See more details on using hashes here.

File details

Details for the file pyqrack_complex128-2.1.0-py3-none-manylinux_2_35_x86_64.whl.

File metadata

File hashes

Hashes for pyqrack_complex128-2.1.0-py3-none-manylinux_2_35_x86_64.whl
Algorithm Hash digest
SHA256 b5cc66792237119e45d1bec5bb3ab2f8f4d5e8715e3b0801cb656606d828e7ab
MD5 c4ce77c6d0e0820b2cda95181a65a75d
BLAKE2b-256 d662386b62d2ac298fd361ce11a550dc1d34a62be6fa86f618ad81bd274c0b1c

See more details on using hashes here.

File details

Details for the file pyqrack_complex128-2.1.0-py3-none-macosx_15_0_x86_64.whl.

File metadata

File hashes

Hashes for pyqrack_complex128-2.1.0-py3-none-macosx_15_0_x86_64.whl
Algorithm Hash digest
SHA256 44f84cdc8f91d85ca521bc2361c5f1e8a068541e65f6f08ab9e7e50e5068dccb
MD5 9724b05779457b3358c8673beee01320
BLAKE2b-256 1de75ab6247793dcb2b6b83fadcad9240e23b10c1f90fb082874ac532c32d442

See more details on using hashes here.

File details

Details for the file pyqrack_complex128-2.1.0-py3-none-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for pyqrack_complex128-2.1.0-py3-none-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 03c4ad2a0a7a8c1dd263259d3061bdb85ee477aaabadc57070a91df29062eec0
MD5 f9831481e74549d69156f7edc6d0b250
BLAKE2b-256 234cffe259d08c35f886536f584382b87fdcec55c6dd4b2ee73c6ef11dbde668

See more details on using hashes here.

File details

Details for the file pyqrack_complex128-2.1.0-py3-none-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for pyqrack_complex128-2.1.0-py3-none-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 c534e900e54112082d9bebb1b8487563ca20d2b9124be81c66166cde58a5f452
MD5 27cb93682bfed8e04ad747d5a80974e0
BLAKE2b-256 d77651881841e6b7da5af21d5091146b871f820dcfa6e89cd4f73da9b990d4c1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page