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 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 installing from source, it doesn't matter whether you use pyqrack or pyqrack-cpu, because the build version of C++ Qrack you intend to use must already be installed locally.)

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

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, and to the broader community of Qrack contributors, for years of happy Qracking! You rock!

Project details


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.32.7.tar.gz (34.0 kB view details)

Uploaded Source

Built Distributions

pyqrack_cpu-1.32.7-py3-none-win_amd64.whl (681.1 kB view details)

Uploaded Python 3 Windows x86-64

pyqrack_cpu-1.32.7-py3-none-manylinux_2_39_x86_64.whl (2.1 MB view details)

Uploaded Python 3 manylinux: glibc 2.39+ x86-64

pyqrack_cpu-1.32.7-py3-none-manylinux_2_35_x86_64.whl (2.1 MB view details)

Uploaded Python 3 manylinux: glibc 2.35+ x86-64

pyqrack_cpu-1.32.7-py3-none-manylinux_2_31_x86_64.whl (2.1 MB view details)

Uploaded Python 3 manylinux: glibc 2.31+ x86-64

pyqrack_cpu-1.32.7-py3-none-macosx_13_0_x86_64.whl (1.7 MB view details)

Uploaded Python 3 macOS 13.0+ x86-64

pyqrack_cpu-1.32.7-py3-none-macosx_12_0_x86_64.whl (1.6 MB view details)

Uploaded Python 3 macOS 12.0+ x86-64

File details

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

File metadata

  • Download URL: pyqrack_cpu-1.32.7.tar.gz
  • Upload date:
  • Size: 34.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for pyqrack_cpu-1.32.7.tar.gz
Algorithm Hash digest
SHA256 5e9174f9c3f2fb2fdbc583220718ad14f34cbeaec032a4b14c8438f024c61a0f
MD5 5245de9472d41a55ce23afe9bdd119d8
BLAKE2b-256 7887c4cd8fb28b82ef04c7e34323fea367e8d726abd3c992403f959908092a5e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack_cpu-1.32.7-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 49d68a7d3b170dfc03af0d861869e6ebd6a807335d66c32f1ac0d207e49200bf
MD5 0ba9fa8d426639d8848d81f0296d6ae0
BLAKE2b-256 3391ffca5f92b5e5a07c42c9431d21b194e9d4e92fbf92fec7ecee7a331b1fba

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack_cpu-1.32.7-py3-none-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 cc15b0fc760e58b474426485769c302c544c184349fe388ed373db21a49d388c
MD5 d7e4c4075d6d4b9779c5ff5341a607d8
BLAKE2b-256 7a4c5447cbfd72ccb29eb4b6fb379a74cb6abfc79a81a1293a70dfa52e44a463

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack_cpu-1.32.7-py3-none-manylinux_2_35_x86_64.whl
Algorithm Hash digest
SHA256 de88877b97ce2a1d79b8b94a49ed3a32a1a74ce46fcebcb72a7503f04ba29218
MD5 5200951eb8ccdc3b90fea5594e79e79b
BLAKE2b-256 d01b385ede1f17dbe880d028477a617bb7b1f3f9cdee1cb7cda6ea2757be73c5

See more details on using hashes here.

File details

Details for the file pyqrack_cpu-1.32.7-py3-none-manylinux_2_31_x86_64.whl.

File metadata

File hashes

Hashes for pyqrack_cpu-1.32.7-py3-none-manylinux_2_31_x86_64.whl
Algorithm Hash digest
SHA256 2b24dd0e196042ef115ee77c9ba11e2973aa56e4ac10efa55ffc3bc465fbc404
MD5 24fe688b19d13c4da277c4c6b1000cf0
BLAKE2b-256 666a6badb9177b2e36386aac88924364f901bff7a879b4bd218526094a4d350b

See more details on using hashes here.

File details

Details for the file pyqrack_cpu-1.32.7-py3-none-macosx_13_0_x86_64.whl.

File metadata

File hashes

Hashes for pyqrack_cpu-1.32.7-py3-none-macosx_13_0_x86_64.whl
Algorithm Hash digest
SHA256 b7505c5da5f0fd161a788a7d014c5c5a084b84c072fabb5533ec47bc39824d8e
MD5 c5d8e2290c7a2de23303fadb90eb4f6d
BLAKE2b-256 f62f0a9050c061612da903b666705df023a8666917d545d19ce1b18ef7a9d5fc

See more details on using hashes here.

File details

Details for the file pyqrack_cpu-1.32.7-py3-none-macosx_12_0_x86_64.whl.

File metadata

File hashes

Hashes for pyqrack_cpu-1.32.7-py3-none-macosx_12_0_x86_64.whl
Algorithm Hash digest
SHA256 a79852c844b83effbd9b727d843ca69920875d744f2053154f216edd0d90ed19
MD5 6d289e4879299b4889b8be68290ba879
BLAKE2b-256 73e8fff14677c2f04531b6f3fe3bd8c883ef824c92fefe5f694a79667afc5a2b

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page