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.80.3.tar.gz (51.7 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.80.3-py3-none-win_amd64.whl (841.4 kB view details)

Uploaded Python 3Windows x86-64

pyqrack_cpu_complex128-1.80.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.80.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.80.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.80.3-py3-none-macosx_15_0_arm64.whl (1.9 MB view details)

Uploaded Python 3macOS 15.0+ ARM64

pyqrack_cpu_complex128-1.80.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.80.3.tar.gz.

File metadata

  • Download URL: pyqrack_cpu_complex128-1.80.3.tar.gz
  • Upload date:
  • Size: 51.7 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.80.3.tar.gz
Algorithm Hash digest
SHA256 7914968ed28e9792ea88c7bc81de0e9514a322b2b57233c75d2e6de4a0214115
MD5 5564ed6cc143492b22d2a333b9a178c8
BLAKE2b-256 ad1302cade38e6b7d81e11489231438b5eb71e7457e47bb60e66121b9ace92cd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack_cpu_complex128-1.80.3-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 37a9e0a632796a6b40eba3329d1ac3fa03e3c918bccf2bd6f8c6556dea9c2ee0
MD5 cde5f0250d11b8174ab4050b215c6def
BLAKE2b-256 76533c66918c0b06d960d1c66ea35eb630d19f0c53e7d6463b9da82238a41aad

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack_cpu_complex128-1.80.3-py3-none-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 a8c24e4d6e66b71ca97258657db817c2636f4585654933923bd0935ed819f93e
MD5 04807f8aaefc84d177c828a8413bf6bd
BLAKE2b-256 dee2e315e75f30451e84025d9441c10e118b517d28cd596d2d8eb65c3d029198

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack_cpu_complex128-1.80.3-py3-none-manylinux_2_35_x86_64.whl
Algorithm Hash digest
SHA256 31ddfdc785fc726d29c6753526e4a9e5b9b6ca0a939d8ee5bc84e43776a9c357
MD5 7abd2244177931822cebe1c7c41b5a46
BLAKE2b-256 7b3c564ade653b73eaab6d29df818d40cab0d150019d75e06eaff89ab58df96e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack_cpu_complex128-1.80.3-py3-none-macosx_15_0_x86_64.whl
Algorithm Hash digest
SHA256 b21a84e853572f74b1576702dabb11cbb794ed8dd539b0d69bff634acbf0ae26
MD5 ae72cf7b8adf991ef6ca7afda26127d2
BLAKE2b-256 fd2fae45d0175d0cce9949832aef6c971fe9f817cee64ccd148ed985ce8d572c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack_cpu_complex128-1.80.3-py3-none-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 68bb20d63f98d1e35ac673e1640a5eae8b6bc333c85b37af269cf3f1371233c6
MD5 8c819999c48ff6dd02b57ec7af1dc52b
BLAKE2b-256 31676795493e95fc60c302c3f01ac21f1dd7bf9880b9e222728912ddd14f073a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack_cpu_complex128-1.80.3-py3-none-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 dc9e854a682f70d4a7b7fcee1eab2625708e794308601a62f31c90476bd38249
MD5 23c9536dbf1f7498a4928a143c594dd9
BLAKE2b-256 d2ea2429bd6786ad3ec0188c7864404e64ce3b959604f4aeb93c5b6a16f17316

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