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.5.1.tar.gz (61.2 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.5.1-py3-none-win_amd64.whl (993.6 kB view details)

Uploaded Python 3Windows x86-64

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

Uploaded Python 3manylinux: glibc 2.39+ x86-64

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

Uploaded Python 3manylinux: glibc 2.35+ x86-64

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

Uploaded Python 3macOS 15.0+ x86-64

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

Uploaded Python 3macOS 15.0+ ARM64

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

File metadata

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

File hashes

Hashes for pyqrack-2.5.1.tar.gz
Algorithm Hash digest
SHA256 eae57cd7db05ac57b9a73486768405e0b2b24140b49f2ff300d1dccacd85b856
MD5 37247855831c01359b8167de191dfd88
BLAKE2b-256 41c93c78040b85ecb18a64d0a45933ce34fd81bf0e60d3e85630785a624f5f76

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pyqrack-2.5.1-py3-none-win_amd64.whl
  • Upload date:
  • Size: 993.6 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.5.1-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 c53a2c3584c068bdb90974de08d32fa8bf7fbe87dde5a832952741d87e08bb0a
MD5 b23df80aae71335b884e2abc0fe053b1
BLAKE2b-256 0a471f8fdf6a201a1dc3e26db9d4d190d1ecbdd8778b57e9f6676800c099a573

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack-2.5.1-py3-none-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 c5a26ea56a1318ad91f822921eb4efa66450931dc26b3d3ad287220069cdd67f
MD5 66efabdd5fe2e6d118436eed1aa5b050
BLAKE2b-256 5ecec8ed73cab1bcacdc7317b58a350b71196a49475d7286d11f7cdb60003070

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack-2.5.1-py3-none-manylinux_2_35_x86_64.whl
Algorithm Hash digest
SHA256 f6b80a81e2583ccb2562b05cfa0c27a434b92d404ab60df6c08bbd90fce8d71a
MD5 29be4d90e393f6e705e9c43f1ff86a4c
BLAKE2b-256 05924478422a87eefd7ef7db5160f991ce2af06036b5b933419a00beb7a38e20

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack-2.5.1-py3-none-macosx_15_0_x86_64.whl
Algorithm Hash digest
SHA256 1e385c3e246830a36e4bf5a73d6536bbf19583be09db6ed18874cf152ac9a100
MD5 84b0294ee1f892c934731ad736fb6f08
BLAKE2b-256 848bf85d959626da11bd21fe69ee6cfa24fe570d2753c56eb02f3b48b3e21dda

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack-2.5.1-py3-none-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 3208cde7dc7f97c386eb2b525f6a9fe055b13887d2f6e0175686dce6efc55d85
MD5 a696d946594b493149a40d73453404bf
BLAKE2b-256 6a3dd4a11138d643f69776cc100ee9b4d0b13b21981d3556cb78424cbe708ddf

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack-2.5.1-py3-none-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 35c46d0065f1347ab296fb19bea7b279be8e8a948a2bc791c2e4f4b4a911df39
MD5 8bb589f616d74c03d49d91bb97446ba9
BLAKE2b-256 b3e438600f253f54e411a4be38b2802a2afcccee8846dfccf2dd619d33085818

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