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.65.2.tar.gz (49.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-1.65.2-py3-none-win_amd64.whl (902.3 kB view details)

Uploaded Python 3Windows x86-64

pyqrack_complex128-1.65.2-py3-none-manylinux_2_39_x86_64.whl (3.1 MB view details)

Uploaded Python 3manylinux: glibc 2.39+ x86-64

pyqrack_complex128-1.65.2-py3-none-manylinux_2_35_x86_64.whl (3.1 MB view details)

Uploaded Python 3manylinux: glibc 2.35+ x86-64

pyqrack_complex128-1.65.2-py3-none-macosx_15_0_arm64.whl (1.7 MB view details)

Uploaded Python 3macOS 15.0+ ARM64

pyqrack_complex128-1.65.2-py3-none-macosx_14_0_arm64.whl (1.7 MB view details)

Uploaded Python 3macOS 14.0+ ARM64

pyqrack_complex128-1.65.2-py3-none-macosx_13_0_x86_64.whl (2.0 MB view details)

Uploaded Python 3macOS 13.0+ x86-64

File details

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

File metadata

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

File hashes

Hashes for pyqrack_complex128-1.65.2.tar.gz
Algorithm Hash digest
SHA256 0bdb63ccb8e53745c249f103e0284b9f01a62ff0b685db23458e51f726bdc439
MD5 f36dbd60dd78ab9609ffbef6d0ecf451
BLAKE2b-256 801cca9cdc4b48ddc08f7ec28a49258210ff7de00f8dc60366aeab3ec87bb4f5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack_complex128-1.65.2-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 180bb6d69722c6c39b070244da04c7364c87542f543385163dd110b6e22b564f
MD5 0c717b7b2e65c7ab1eee70ecc1447bd6
BLAKE2b-256 5968163958371e5a8ed9914c3fe6d1264bdffd673166ad2ecaf7b2f0bbd0a16e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack_complex128-1.65.2-py3-none-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 5b8391bd092374dd49542c7e3625b5e7cda7ef50ab1f14c613ac6aa7be5835b0
MD5 cc57a16abfd2a9ac702b42a0e8392c41
BLAKE2b-256 3d6c889aaf6a5557fb8350cf4acc3170f98aeb4d1340c4aac0fe63e14ba9a866

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack_complex128-1.65.2-py3-none-manylinux_2_35_x86_64.whl
Algorithm Hash digest
SHA256 f4eae0221bab15326698f17545fd19aef2937d6b1fdc329144a5981353962ad1
MD5 c56038789fd43093e71d6b802506a23c
BLAKE2b-256 37c2af66127ec16e82e16630becae6213defff9c9757c8615b1a3f55cb05096d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack_complex128-1.65.2-py3-none-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 bd5f340bc5b6fc3b863c0aa0d009db8276f09b2ae2902c4a8b22c40ab5a9da3d
MD5 dbba5ef0911418bbb39910a6ac931b31
BLAKE2b-256 1ba3dc1e1cce877c6a0ac75c0d5dc068a54a6193c1562fcca7fe349f0e9dda96

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack_complex128-1.65.2-py3-none-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 7c6b1baea5a062c812c1f9528667aa120e5ce9cc0c3da4a3f47ba0eace577e73
MD5 109112df4da2e8afdab8cbc1bbc32844
BLAKE2b-256 e451872818c428562100ebf9038a957b4293a9f0cbd0b8450db2c3263350d783

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack_complex128-1.65.2-py3-none-macosx_13_0_x86_64.whl
Algorithm Hash digest
SHA256 bbf14ec5123bfe6dde90e779a50e1384fab9238a1b3e904f2ea21604e9e8bd32
MD5 a017294deb160f084d35e12c46f82483
BLAKE2b-256 3d71491c7f647b60db95958665b4a966fd895f9f2eb6bdd150f66255072ee967

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