Skip to main content

pyqrack - Pure Python vm6502q/qrack Wrapper

Project description

pyqrack

Downloads Downloads Downloads

Pure Python bindings for the pure C++11 Qrack quantum computer simulator library

(PyQrack is just pure Qrack.)

This is the purely CPU-based variant of PyQrack (with module name pyqrack-cpu). This alternate build of PyQrack is provided so that systems that won't use OpenCL or CUDA anyway (such as because they lack any GPUs or other accelerators like the Intel HD) do not need to install the OpenCL library in order to use PyQrack. In this form, both the PyQrack module and the underlying C++ Qrack library are entirely external dependency-free.

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."

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_cpu_complex128-1.82.3.tar.gz (51.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_cpu_complex128-1.82.3-py3-none-win_amd64.whl (840.3 kB view details)

Uploaded Python 3Windows x86-64

pyqrack_cpu_complex128-1.82.3-py3-none-manylinux_2_39_x86_64.whl (2.8 MB view details)

Uploaded Python 3manylinux: glibc 2.39+ x86-64

pyqrack_cpu_complex128-1.82.3-py3-none-manylinux_2_35_x86_64.whl (2.8 MB view details)

Uploaded Python 3manylinux: glibc 2.35+ x86-64

pyqrack_cpu_complex128-1.82.3-py3-none-macosx_15_0_x86_64.whl (2.1 MB view details)

Uploaded Python 3macOS 15.0+ x86-64

pyqrack_cpu_complex128-1.82.3-py3-none-macosx_15_0_arm64.whl (1.9 MB view details)

Uploaded Python 3macOS 15.0+ ARM64

pyqrack_cpu_complex128-1.82.3-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_cpu_complex128-1.82.3.tar.gz.

File metadata

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

File hashes

Hashes for pyqrack_cpu_complex128-1.82.3.tar.gz
Algorithm Hash digest
SHA256 77405df9462322855ea0a9a7e830c8c06317449dad45cebe37106932b66e7307
MD5 5603dacc2d58627d5166f2ad873d297b
BLAKE2b-256 840134dee2b52b175311b465694060a9178a18ef59cfaec43f9a836e6d2d1cff

See more details on using hashes here.

File details

Details for the file pyqrack_cpu_complex128-1.82.3-py3-none-win_amd64.whl.

File metadata

File hashes

Hashes for pyqrack_cpu_complex128-1.82.3-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 a26187250213c65b9280141412008f639a71ad6b206a44130548825c8fdc0079
MD5 a50b3f816474513cc0c73a61d042218d
BLAKE2b-256 8892a346fb59ea55a4443d1ca0093abdbcc7e1378ac48853eac4faada363554c

See more details on using hashes here.

File details

Details for the file pyqrack_cpu_complex128-1.82.3-py3-none-manylinux_2_39_x86_64.whl.

File metadata

File hashes

Hashes for pyqrack_cpu_complex128-1.82.3-py3-none-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 7e320522d24e601841afbfd0f6dae1c570e5bd4e789019dc4f90d66ea1c9f9b3
MD5 26723f1a7dbdc7ed27c4238e5678ee99
BLAKE2b-256 7ddc4cf0262869b01f07bbadb8d592be1bbc77e0e0a9160a3a52840d44c9fd93

See more details on using hashes here.

File details

Details for the file pyqrack_cpu_complex128-1.82.3-py3-none-manylinux_2_35_x86_64.whl.

File metadata

File hashes

Hashes for pyqrack_cpu_complex128-1.82.3-py3-none-manylinux_2_35_x86_64.whl
Algorithm Hash digest
SHA256 68dd23a43d6338e9c8334ccac7969eb77d47559c4c2c11535b86f084719e40a8
MD5 7da51eda3289c2ce365edc4d166d799e
BLAKE2b-256 44c6231497712a4c8f808d5329612ffad399a5e30560eb76a5ac6bdcd7ffce38

See more details on using hashes here.

File details

Details for the file pyqrack_cpu_complex128-1.82.3-py3-none-macosx_15_0_x86_64.whl.

File metadata

File hashes

Hashes for pyqrack_cpu_complex128-1.82.3-py3-none-macosx_15_0_x86_64.whl
Algorithm Hash digest
SHA256 bd7bd7b8600a2d4a552380fee31ac9a63d539ca4bd50001673a235e2cfa4b0d7
MD5 1867d2c11c6f48162c158a5dece6ae63
BLAKE2b-256 16357c913972866cf57b28637c75af00d7a48b3e61fdea860003480cc3ad3a99

See more details on using hashes here.

File details

Details for the file pyqrack_cpu_complex128-1.82.3-py3-none-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for pyqrack_cpu_complex128-1.82.3-py3-none-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 c1b1bd5b65d7316cb8c1b493cba763cb4e1934da9d9e97fa5d8f2bf4df365a1d
MD5 092128c9a5472524b48b6092c10dac38
BLAKE2b-256 4fb4d3bc4d578345b7d8a93135f7e899295eeb4b17feaf1183ab3e69134958e3

See more details on using hashes here.

File details

Details for the file pyqrack_cpu_complex128-1.82.3-py3-none-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for pyqrack_cpu_complex128-1.82.3-py3-none-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 d9a44c987e6c7517adf54fe3d0f9bb2b25282a35bb28b36775def0f9b01ba21e
MD5 89cc1d5788772bedbe805247b2a6e986
BLAKE2b-256 4ea3a3ceabab551ab75c1219b420292e52e242fe6f3e1cbf3f0bbe2af2641d1e

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