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-1.89.0.tar.gz (56.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-1.89.0-py3-none-win_amd64.whl (994.1 kB view details)

Uploaded Python 3Windows x86-64

pyqrack-1.89.0-py3-none-manylinux_2_39_x86_64.whl (3.6 MB view details)

Uploaded Python 3manylinux: glibc 2.39+ x86-64

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

Uploaded Python 3manylinux: glibc 2.35+ x86-64

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

Uploaded Python 3macOS 15.0+ x86-64

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

Uploaded Python 3macOS 15.0+ ARM64

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

File metadata

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

File hashes

Hashes for pyqrack-1.89.0.tar.gz
Algorithm Hash digest
SHA256 18d613aafe315312205b985c21b99eda53b642c8e9d9f86bbec351a712dd4903
MD5 beae673d8c3f2e70fa93453dcc11049e
BLAKE2b-256 bab773ed7f70d003ba84396e077f7c83c15ae01501ca979f3857dc76da208664

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for pyqrack-1.89.0-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 49c864d3ce8a2cfe5efdcdda6077a5602afa53288cb685f1a25f3cc2e10cfda9
MD5 0bbaa82f61360cc58bf59538a24eff50
BLAKE2b-256 bff89ab2b12d1539f64a76112089f4b5a644a61affb08aa7280e463be06c741d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack-1.89.0-py3-none-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 3d890006ff12ba62b28f6896e5a9c27d2e1627044dc2dc593dd85a3f5442932b
MD5 035a700e816d845fffb35a74842d8c5b
BLAKE2b-256 839ebf705d78a6124c065a093dff183625d71761ac39e39c120f4bacc1c1c514

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack-1.89.0-py3-none-manylinux_2_35_x86_64.whl
Algorithm Hash digest
SHA256 bf98c592d1a8e7e15b653d8498e2aeb046cbe4cb5a35db80bf83197279fcd2e2
MD5 e37660cabacdf58dea8bc8cbb5340e16
BLAKE2b-256 67e1c5fe0ea6c0ef810bc5100a6fbe2cd05aafdb46a96ee835da73ddfbf18603

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack-1.89.0-py3-none-macosx_15_0_x86_64.whl
Algorithm Hash digest
SHA256 bd77a05c8eafa6da97de1617ee1df9db4540f19714dda8e0435125e76004472b
MD5 816087a65912793c57da55989ddaed74
BLAKE2b-256 fddc56ee2b45bb8b28026eaac88151576a6b1dfdc317c8feb2877ef4c5aa7896

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack-1.89.0-py3-none-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 56221ff2b708a40fca04d9a74a49bef0e1b3dc27d8727af7dc19de3e54c3692f
MD5 226fc33ee00adea44278460d6ececc4e
BLAKE2b-256 d8e6d81f8f6ac942be5216c96f299062659e40796993b851ad3a4a08fe6c72ab

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack-1.89.0-py3-none-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 db877654d1e3569c773ce33bebd814f24a486e8dac10cf8a10f325f318b7a37a
MD5 10cecd4cda46d923b64d7fa388ea53ff
BLAKE2b-256 b3858829bf232a758bd23fcd66c8501672d1df477d2de5b287d7e7448d4c72be

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