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-2.2.1.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-2.2.1-py3-none-win_amd64.whl (988.5 kB view details)

Uploaded Python 3Windows x86-64

pyqrack-2.2.1-py3-none-manylinux_2_39_x86_64.whl (3.7 MB view details)

Uploaded Python 3manylinux: glibc 2.39+ x86-64

pyqrack-2.2.1-py3-none-manylinux_2_35_x86_64.whl (3.7 MB view details)

Uploaded Python 3manylinux: glibc 2.35+ x86-64

pyqrack-2.2.1-py3-none-macosx_15_0_x86_64.whl (2.1 MB view details)

Uploaded Python 3macOS 15.0+ x86-64

pyqrack-2.2.1-py3-none-macosx_15_0_arm64.whl (1.9 MB view details)

Uploaded Python 3macOS 15.0+ ARM64

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

File metadata

  • Download URL: pyqrack-2.2.1.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-2.2.1.tar.gz
Algorithm Hash digest
SHA256 dc406bd85139363366fda6f474233438d7246e4e61c62a2bdebc500a9476288e
MD5 0c58e3d444e09484355356b9184107fd
BLAKE2b-256 26ad7ef368c543adbc737a931969a31d7a0151afacd7c1118376817654da06fd

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pyqrack-2.2.1-py3-none-win_amd64.whl
  • Upload date:
  • Size: 988.5 kB
  • Tags: Python 3, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for pyqrack-2.2.1-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 05487d71403b41bbed893f93f5ea6a9a05fa98290e1ad060c38f7a6d378085c5
MD5 d40b0f2435f67cc2afbc0b09edea704e
BLAKE2b-256 1752047fc041758abd5b579febef76226a9feaf3fa8b4f4aa175decd4c5afda3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack-2.2.1-py3-none-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 500fda95d3cb1248da22d95936313509459aa622513a4643bbf6021711bff7d6
MD5 2d2a8781bf04086af57c82a4139bc697
BLAKE2b-256 ee72e3f6552eaf0e45351235e027610b1fb2f93f89cf20fe9536652ced7ec99c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack-2.2.1-py3-none-manylinux_2_35_x86_64.whl
Algorithm Hash digest
SHA256 134394be9756d10c4e54174cd58dafa4099bfe746f04ee19a6891e1c950c0ee3
MD5 f41ac7f2cd931d3fd438771a8ab95b62
BLAKE2b-256 77523f760aafd3168ae5e26c28016ae3c9f3de1dcc49113d4f74e8659fd1734a

See more details on using hashes here.

File details

Details for the file pyqrack-2.2.1-py3-none-macosx_15_0_x86_64.whl.

File metadata

File hashes

Hashes for pyqrack-2.2.1-py3-none-macosx_15_0_x86_64.whl
Algorithm Hash digest
SHA256 47f98f19055ecb602bd42281ad3be6e81be291263bf0990257bcd7f3c2201caf
MD5 287b52b2a94aceeaa479f9f4e3e70e23
BLAKE2b-256 dec1993a98d43dbb9c300654c43bcc7c8424716d709b442b153edb4bb09058b5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack-2.2.1-py3-none-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 07680b48df7674f5189b3578a6576bd78aab06e00e3559467b59559a39a3bf83
MD5 1194925ffe5e9fca0f7affdd717c7878
BLAKE2b-256 54865928bd8c0c32605025138b4583530c2c6d5be35d0be2d7ba7c8eabfbf11c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack-2.2.1-py3-none-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 ffc556ffb69b3dca3b372cb403ef8cab61e81ecff4462d66ada4520c99a84f04
MD5 200f2425860afd1782af3fd7e6aeadff
BLAKE2b-256 fd766bfbb96a2a13a826d7c57c86c81c5f54110f89add569ea80f6bc0f4c5c97

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