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

Uploaded Python 3Windows x86-64

pyqrack_complex128-2.1.2-py3-none-manylinux_2_39_x86_64.whl (3.7 MB view details)

Uploaded Python 3manylinux: glibc 2.39+ x86-64

pyqrack_complex128-2.1.2-py3-none-manylinux_2_35_x86_64.whl (3.7 MB view details)

Uploaded Python 3manylinux: glibc 2.35+ x86-64

pyqrack_complex128-2.1.2-py3-none-macosx_15_0_x86_64.whl (2.1 MB view details)

Uploaded Python 3macOS 15.0+ x86-64

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

Uploaded Python 3macOS 15.0+ ARM64

pyqrack_complex128-2.1.2-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_complex128-2.1.2.tar.gz.

File metadata

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

File hashes

Hashes for pyqrack_complex128-2.1.2.tar.gz
Algorithm Hash digest
SHA256 86144309ec4f04ee5b004da0c2fed9129a961ebc0851f1e9dcceb5d8d2dd462f
MD5 b56ee9657cc7f9fe559a1fdd70635d1e
BLAKE2b-256 fcb8ce75bf442ec29da8b1901da4c704ae2b24a256ea4f28dbd2d46ea90ec100

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack_complex128-2.1.2-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 2be6a2890308f6e64c8e328a444bc0df68b72d3d3e8989a7accc76f00876d342
MD5 5c8cbd5a98d97fd8f5adc918f2e55f5e
BLAKE2b-256 ae6f4cdfc9fb0c0363c641d2e6030e06ad48bbb5898794cbb4ed9f993becf457

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack_complex128-2.1.2-py3-none-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 cfac0bcc99b1db5be455fd996cf29bac974cb5a79327889793c8cc2bb6a2c865
MD5 26b36c57486805f36f06fe789b528d73
BLAKE2b-256 74f6d3c30bb203c6099c9cba7768b52d72f18a3aa3608654069f016367c54c06

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack_complex128-2.1.2-py3-none-manylinux_2_35_x86_64.whl
Algorithm Hash digest
SHA256 b1ed194c5564270f67464194118a63e24029817d4eaa67697742f26b193988ec
MD5 69cff165009b62ac76b0b21ad5639348
BLAKE2b-256 90f1f1ad5c47248ca5ef9d90f57ef8277d757b05621f681e8dcf5c0853f1b966

See more details on using hashes here.

File details

Details for the file pyqrack_complex128-2.1.2-py3-none-macosx_15_0_x86_64.whl.

File metadata

File hashes

Hashes for pyqrack_complex128-2.1.2-py3-none-macosx_15_0_x86_64.whl
Algorithm Hash digest
SHA256 6168272d94fd239fa0afc1d917db70e3883169c434d84e32ab8d644797e2532e
MD5 80b884f92fc0293960309312f5e9c070
BLAKE2b-256 d8a90dc438cb7be163578ac26d75099eceb6a5f6add8388929bf84b8b745edbb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack_complex128-2.1.2-py3-none-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 24be894374e7e0f533cfc10557b609d930496512733a0d49c3a644af76d5c953
MD5 a75749a786ccf8e4328dd6b3d7779ddf
BLAKE2b-256 e5bceb8ed67ad919c12b560d6467d00246c184cefd411919874f425e2462cf3a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack_complex128-2.1.2-py3-none-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 1abaea1f40fa30dc6867ec74fd62381b140e43a3ad77e152a931d0597914f67f
MD5 b1d6bb3de16bb12fc57c196b6214b9b1
BLAKE2b-256 830a51a69ffcb7f3c757f7ad7eaa0a8e7369a195b604c0877fc18fe44dd59362

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