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-1.70.4.tar.gz (49.5 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-1.70.4-py3-none-win_amd64.whl (1.0 MB view details)

Uploaded Python 3Windows x86-64

pyqrack_complex128-1.70.4-py3-none-manylinux_2_39_x86_64.whl (3.5 MB view details)

Uploaded Python 3manylinux: glibc 2.39+ x86-64

pyqrack_complex128-1.70.4-py3-none-manylinux_2_35_x86_64.whl (3.4 MB view details)

Uploaded Python 3manylinux: glibc 2.35+ x86-64

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

Uploaded Python 3macOS 15.0+ ARM64

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

Uploaded Python 3macOS 14.0+ ARM64

pyqrack_complex128-1.70.4-py3-none-macosx_13_0_x86_64.whl (2.2 MB view details)

Uploaded Python 3macOS 13.0+ x86-64

File details

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

File metadata

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

File hashes

Hashes for pyqrack_complex128-1.70.4.tar.gz
Algorithm Hash digest
SHA256 e9184a9272bb20f9f1da1523e40f7faef5edc58c53781e23eaa14ce9b37362d0
MD5 39e86d17ecc99087031633018a956510
BLAKE2b-256 e91e271b0e4f2937a16fed23e4dd3bc71a00511eb7eba5093deef5ace250477d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack_complex128-1.70.4-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 21566e5072eb61f2edcd80cd9a68036326130c29ee084aaaffb2a44c82e5cb3e
MD5 3ed1fb771bbdaee25b32c44fec3203d0
BLAKE2b-256 82ab6750d84bde135e7febba679a5b08c2c086c300f2c929b9c428b14b88df70

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack_complex128-1.70.4-py3-none-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 153202e314b3dda1706919f8af350b36126b9816203818d5669c3c76392bc924
MD5 2768210a03a5ba328b4ab6253d49577f
BLAKE2b-256 d766ac0b0d6b6669a985067655dc3d662690594a65f6ab1dc9f897905c2ce2c0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack_complex128-1.70.4-py3-none-manylinux_2_35_x86_64.whl
Algorithm Hash digest
SHA256 ec355c9de36de78d6172bf8727c4056bdc00d6c6b06a79bec81b5d69be179046
MD5 1fa7063a86fdbee717665913e02b4473
BLAKE2b-256 3392480c9a182085beed90e578c8e2e95b7d2564ac0ec9e73a0c571bc9050b3a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack_complex128-1.70.4-py3-none-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 aa50f7f502a169262ddab537a2eac9cef8ab457f84f1fd1c78592721aca92e37
MD5 5682b46b140c877397869cb98cef915a
BLAKE2b-256 d44ff2ea2f4be401a86dc4be4169f7eb92a9a04187ea8a92723838f58b4f32a9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack_complex128-1.70.4-py3-none-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 cea9fed2830e17d89dca40ce9bdcf21c49768182d239800fe5e86b40d79a0b09
MD5 e17acd226b73dc52fc9fcaf79e795b47
BLAKE2b-256 bfe045a6d6343964e4e61d935ca22f16b1c0ddd3d401bb837e5c38ed34244561

See more details on using hashes here.

File details

Details for the file pyqrack_complex128-1.70.4-py3-none-macosx_13_0_x86_64.whl.

File metadata

File hashes

Hashes for pyqrack_complex128-1.70.4-py3-none-macosx_13_0_x86_64.whl
Algorithm Hash digest
SHA256 95612cb5d1f5ac95a72aa8917eb2b03993d31bb5229483a1db095a6ec64f995d
MD5 6b26f6c98e0f5673a43455b1b29b3512
BLAKE2b-256 a13cefaa0e0eaf7c80a8112cb751d021b2a963cb368240704b1d6b362f0b62f8

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