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

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

Note, if building from source: You must build and install unitaryfund/qrack to build the main branch from source. CI/CD builds wheels that contain pre-compiled Qrack binaries, and that is the form published on PyPi. You must also install OpenCL.

main

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

Uploaded Source

Built Distributions

pyqrack_cpu-1.32.12-py3-none-win_amd64.whl (689.2 kB view details)

Uploaded Python 3 Windows x86-64

pyqrack_cpu-1.32.12-py3-none-manylinux_2_39_x86_64.whl (2.2 MB view details)

Uploaded Python 3 manylinux: glibc 2.39+ x86-64

pyqrack_cpu-1.32.12-py3-none-manylinux_2_35_x86_64.whl (2.2 MB view details)

Uploaded Python 3 manylinux: glibc 2.35+ x86-64

pyqrack_cpu-1.32.12-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.12-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.12-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.12.tar.gz.

File metadata

  • Download URL: pyqrack_cpu-1.32.12.tar.gz
  • Upload date:
  • Size: 34.3 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.12.tar.gz
Algorithm Hash digest
SHA256 535a8d7e3b8d8360812e7d9da609ea65220658f626691d8e6e36bfbb17d9a5bd
MD5 85da4e78d20dcb0185e382cb20c64b4c
BLAKE2b-256 c5d0a9909e55aac3c0dae32bae18fb479ae854c09b65ad4213bcfb22e910c24d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack_cpu-1.32.12-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 610791e2c34c6b0ee8c51e6c4e97588b7f7f1600ba53da8eac7e1efed6548bf6
MD5 3fb44dc169377e3be8964f846b67f606
BLAKE2b-256 8319ac34f0e2c0057495006bf1d871eeb62fc49b01b9dd9d6e9781154d587401

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack_cpu-1.32.12-py3-none-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 fc97f62da0df854c13a74a017fc9a36eadae45ec274a4740b0fc207488f63f44
MD5 10ed40d0f44b4188288a75c6114821b2
BLAKE2b-256 17edce0ff9d995f61f6a7b726d945b013d31d16185c0694e5cea608d0bca3c3d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack_cpu-1.32.12-py3-none-manylinux_2_35_x86_64.whl
Algorithm Hash digest
SHA256 026c7e456ab6f62dc0310b4a6bae9cd5b5e5ac791b60f1237cc50b7cc278f47c
MD5 8bcb2b6a2a897fed3ed6771dcc6ab30e
BLAKE2b-256 3b2b003975f30131dea937f2f5bd90c406b7563c7b7c0985bf3df9ca5945f5cc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack_cpu-1.32.12-py3-none-manylinux_2_31_x86_64.whl
Algorithm Hash digest
SHA256 9e01b7a186ca10153f99391fa75141ebded0fad9d076fd3bdfcf1e86d8f6574d
MD5 136c4566f549ab3c601a5823f96515a9
BLAKE2b-256 9605b9b85028d68917a83a907a3219a6cd956cfaa0eaac9e1116e3089a82d370

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack_cpu-1.32.12-py3-none-macosx_13_0_x86_64.whl
Algorithm Hash digest
SHA256 30aea928bbafe1f9ff274f9002c75c7524d17af2f76dd6a6c0e1cb3ac59f5b4f
MD5 375a7c11dcad1c6458cfdbe621f4fae1
BLAKE2b-256 fb64df6cde68ebb409bcb8200955106496429ed4d2510666b46641c696a4befa

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack_cpu-1.32.12-py3-none-macosx_12_0_x86_64.whl
Algorithm Hash digest
SHA256 c8193b822aa0137777492f1fd8c9fb713e73c859499f4e8de1dbb7a16859ae22
MD5 846d872df384c09c6d2f384f291cc903
BLAKE2b-256 9247d6b6c7acd09bfffa52b4cee4960ee2a98d5cccd43cfa418c180cf829cb00

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