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

Uploaded Python 3Windows x86-64

pyqrack_cpu-1.73.0-py3-none-manylinux_2_39_x86_64.whl (2.8 MB view details)

Uploaded Python 3manylinux: glibc 2.39+ x86-64

pyqrack_cpu-1.73.0-py3-none-manylinux_2_35_x86_64.whl (2.8 MB view details)

Uploaded Python 3manylinux: glibc 2.35+ x86-64

pyqrack_cpu-1.73.0-py3-none-macosx_15_0_x86_64.whl (2.1 MB view details)

Uploaded Python 3macOS 15.0+ x86-64

pyqrack_cpu-1.73.0-py3-none-macosx_15_0_arm64.whl (1.9 MB view details)

Uploaded Python 3macOS 15.0+ ARM64

pyqrack_cpu-1.73.0-py3-none-macosx_14_0_arm64.whl (2.0 MB view details)

Uploaded Python 3macOS 14.0+ ARM64

File details

Details for the file pyqrack_cpu-1.73.0.tar.gz.

File metadata

  • Download URL: pyqrack_cpu-1.73.0.tar.gz
  • Upload date:
  • Size: 49.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-1.73.0.tar.gz
Algorithm Hash digest
SHA256 b1cb49eea91d6dd45e553221f6ac38bd66b9eb737c92530d7ae6db2a5f186f9a
MD5 06b4b0e29865971e142b669108f92869
BLAKE2b-256 06d7f7f6d943871403d249bd7b77fce283e5692574574badcf24d606353baba8

See more details on using hashes here.

File details

Details for the file pyqrack_cpu-1.73.0-py3-none-win_amd64.whl.

File metadata

  • Download URL: pyqrack_cpu-1.73.0-py3-none-win_amd64.whl
  • Upload date:
  • Size: 711.4 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_cpu-1.73.0-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 28645ed55ec69ef6f8ab9ebe4dfcfe2fa532a9f0e3626d14b32ba77f555d72e7
MD5 45746ab6553739c4d7617569198a3953
BLAKE2b-256 7abe816077dfe70b63dac9fb36a7f7e36dd31c51d0f7f880ebbf1005b4e8d06b

See more details on using hashes here.

File details

Details for the file pyqrack_cpu-1.73.0-py3-none-manylinux_2_39_x86_64.whl.

File metadata

File hashes

Hashes for pyqrack_cpu-1.73.0-py3-none-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 c61a7d702bc1858439cfd309e6126808f6ecf9f9631a799ef29e073bb3c4b30d
MD5 0d95ae5f1cd85dc7ba3f2faf0e88a725
BLAKE2b-256 a5014ed6b945220e6fa8ac38c86473b49bfca19e1d9e77e1e7d8bb455019cf85

See more details on using hashes here.

File details

Details for the file pyqrack_cpu-1.73.0-py3-none-manylinux_2_35_x86_64.whl.

File metadata

File hashes

Hashes for pyqrack_cpu-1.73.0-py3-none-manylinux_2_35_x86_64.whl
Algorithm Hash digest
SHA256 ddcd2f0ccd653fe37277fe4cafd16e40c8fee85a0e9d00f6a4e97c7ed956a78d
MD5 5b0acb0f1cb3b823243888bcb6a704e5
BLAKE2b-256 6cb27154b2eaa7d2e960cb87a789f2147afe4fafcaf06a7cf6f114037c94470b

See more details on using hashes here.

File details

Details for the file pyqrack_cpu-1.73.0-py3-none-macosx_15_0_x86_64.whl.

File metadata

File hashes

Hashes for pyqrack_cpu-1.73.0-py3-none-macosx_15_0_x86_64.whl
Algorithm Hash digest
SHA256 5dd72e48ade74c33d846d916b103c74683f1821358757f6891911f0409054eb1
MD5 86263f419311ccb3208bdbb5d2772dc3
BLAKE2b-256 73a3305b33a07a39d80e3bb70a05404bd1b603a4d737b4cbd28eae02385bd0b8

See more details on using hashes here.

File details

Details for the file pyqrack_cpu-1.73.0-py3-none-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for pyqrack_cpu-1.73.0-py3-none-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 8c75c18da5a574acb90140877e5939fbd3e903b336393883eb2d9d206b54c036
MD5 7b1fa24101b450c0f669979b7b5d5e70
BLAKE2b-256 f65beb4acd3fba4dcab29006c6ea64268bf649f93686a727e3ac25e19e0c608c

See more details on using hashes here.

File details

Details for the file pyqrack_cpu-1.73.0-py3-none-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for pyqrack_cpu-1.73.0-py3-none-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 386f59121968c026ef3989d16f5be30e4acb1cd3b10db2c647fed778739d89e5
MD5 ba892e440138e4db22a82fdd74008e88
BLAKE2b-256 9a5501b0a24e1c30180c2aae2eafa66ca106aa63f5fbf770179fdb154a9a6992

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