Skip to main content

pyqrack - Pure Python vm6502q/qrack Wrapper

Project description

pyqrack

Downloads Downloads Downloads

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

(PyQrack is just pure Qrack.)

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.

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, 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-1.32.27.tar.gz (34.1 kB view details)

Uploaded Source

Built Distributions

pyqrack-1.32.27-py3-none-win_amd64.whl (868.5 kB view details)

Uploaded Python 3 Windows x86-64

pyqrack-1.32.27-py3-none-manylinux_2_39_x86_64.whl (2.7 MB view details)

Uploaded Python 3 manylinux: glibc 2.39+ x86-64

pyqrack-1.32.27-py3-none-manylinux_2_35_x86_64.whl (2.8 MB view details)

Uploaded Python 3 manylinux: glibc 2.35+ x86-64

pyqrack-1.32.27-py3-none-manylinux_2_31_x86_64.whl (2.7 MB view details)

Uploaded Python 3 manylinux: glibc 2.31+ x86-64

pyqrack-1.32.27-py3-none-macosx_15_0_arm64.whl (1.6 MB view details)

Uploaded Python 3 macOS 15.0+ ARM64

pyqrack-1.32.27-py3-none-macosx_14_0_arm64.whl (1.5 MB view details)

Uploaded Python 3 macOS 14.0+ ARM64

pyqrack-1.32.27-py3-none-macosx_13_0_x86_64.whl (2.2 MB view details)

Uploaded Python 3 macOS 13.0+ x86-64

File details

Details for the file pyqrack-1.32.27.tar.gz.

File metadata

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

File hashes

Hashes for pyqrack-1.32.27.tar.gz
Algorithm Hash digest
SHA256 28df3c60b50a66db1ea4153fa678905988bc647d141c5ae77ae82dc525f5f238
MD5 a404727dd1b6fedae37b146a0ffc7794
BLAKE2b-256 ccfb599bdde5e0e264afca1b24272450cac279a095ce7875d8827c3d8396f600

See more details on using hashes here.

File details

Details for the file pyqrack-1.32.27-py3-none-win_amd64.whl.

File metadata

  • Download URL: pyqrack-1.32.27-py3-none-win_amd64.whl
  • Upload date:
  • Size: 868.5 kB
  • Tags: Python 3, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for pyqrack-1.32.27-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 2e13aef7478c1ff8d98a05bd2f7448aa2098612d019bf8800d153ac2fe5225ba
MD5 76ecbae9269909925efeb40661716ef0
BLAKE2b-256 9939f06b0a4adb27fcaf23710e30590acfb91e72d4ad6bf86e0df22e5aaa4502

See more details on using hashes here.

File details

Details for the file pyqrack-1.32.27-py3-none-manylinux_2_39_x86_64.whl.

File metadata

File hashes

Hashes for pyqrack-1.32.27-py3-none-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 bd23a9ce8a633b6cb70208e4fca6b44dcfbeb1b1c8f1c700470739523b723a5b
MD5 4ae744b3c25a44d5484344b42ed790eb
BLAKE2b-256 40b17318583c3baae5d3457046e9026ce755a3d6d1970d2bb407c9dc547e2257

See more details on using hashes here.

File details

Details for the file pyqrack-1.32.27-py3-none-manylinux_2_35_x86_64.whl.

File metadata

File hashes

Hashes for pyqrack-1.32.27-py3-none-manylinux_2_35_x86_64.whl
Algorithm Hash digest
SHA256 3c651e8a3ee7c3befbd9f0f0092f49604eb6b2d843d956157556bf9d8149e1a7
MD5 c08e3fff3aab941db40e35de62296ef7
BLAKE2b-256 802e730f0e87e30a9ea75d393aecec754748aa562e07fc5eeb34b7096a5d7b45

See more details on using hashes here.

File details

Details for the file pyqrack-1.32.27-py3-none-manylinux_2_31_x86_64.whl.

File metadata

File hashes

Hashes for pyqrack-1.32.27-py3-none-manylinux_2_31_x86_64.whl
Algorithm Hash digest
SHA256 8650e86c0dc6602b1718e8d6b6839b98ee9c30dde6c63de8e04edabba134c76f
MD5 ff400d50c8d737c32cacb440510b16aa
BLAKE2b-256 ad03abc69a671e52d0085fb6573ab3a30b72ed6d87309a27ff5bcfe30f5f4872

See more details on using hashes here.

File details

Details for the file pyqrack-1.32.27-py3-none-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for pyqrack-1.32.27-py3-none-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 732ee202463901dce7da61819fa2425e8be3c2de740584cb4908856934a38808
MD5 c3a6079067a9a1ef96e168f1366b243d
BLAKE2b-256 e124ae05643f642ffec910957b23fd8203f9c674bae955bdc80fdfc20200f1e5

See more details on using hashes here.

File details

Details for the file pyqrack-1.32.27-py3-none-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for pyqrack-1.32.27-py3-none-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 3cd9f1aa4a296737a305cf60e9713f6fafb228e9478d6fbd09e4d49035e20269
MD5 98cd3afaa20c08c9043a4750f28a7e37
BLAKE2b-256 9af362a8a4e1298d62f0558bb2e243ece898e45ad7d401108ea68fe18c60a91f

See more details on using hashes here.

File details

Details for the file pyqrack-1.32.27-py3-none-macosx_13_0_x86_64.whl.

File metadata

File hashes

Hashes for pyqrack-1.32.27-py3-none-macosx_13_0_x86_64.whl
Algorithm Hash digest
SHA256 192cfc7be5c983335a99e6548aff73845030451f00c38bedecb7c8dd0466a4bd
MD5 afdd51ebfb7bc89f98dc79ae593b17d8
BLAKE2b-256 62cc7970ff58fda07c30c5df74a79913f56e80453a34fc1c56dfa11dbd123725

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