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: You must also install OpenCL to use this version of Qrack. (There are also CPU-only and CUDA version.)

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

If you use an integrated graphics accelerator, like the Intel HD, setting environment variable PYQRACK_HOST_POINTER_DEFAULT_ON=1 (or to any "truthy" value) will automatically set the default of isHostPointer option of QrackSimulator to True, to engage "zero-copy" mode by default.

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_complex128-1.80.4.tar.gz (51.6 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

pyqrack_complex128-1.80.4-py3-none-win_amd64.whl (1.0 MB view details)

Uploaded Python 3Windows x86-64

pyqrack_complex128-1.80.4-py3-none-manylinux_2_39_x86_64.whl (3.4 MB view details)

Uploaded Python 3manylinux: glibc 2.39+ x86-64

pyqrack_complex128-1.80.4-py3-none-manylinux_2_35_x86_64.whl (3.4 MB view details)

Uploaded Python 3manylinux: glibc 2.35+ x86-64

pyqrack_complex128-1.80.4-py3-none-macosx_15_0_x86_64.whl (2.1 MB view details)

Uploaded Python 3macOS 15.0+ x86-64

pyqrack_complex128-1.80.4-py3-none-macosx_15_0_arm64.whl (1.9 MB view details)

Uploaded Python 3macOS 15.0+ ARM64

pyqrack_complex128-1.80.4-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_complex128-1.80.4.tar.gz.

File metadata

  • Download URL: pyqrack_complex128-1.80.4.tar.gz
  • Upload date:
  • Size: 51.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for pyqrack_complex128-1.80.4.tar.gz
Algorithm Hash digest
SHA256 fc6d9b2260fcd809797c9001ec2d23d9681f6cd4003c628c1c6c918f65f73527
MD5 2ba9ae6a618cc2fbd2b2cf114cec9cd8
BLAKE2b-256 8066ff3d708f7dcad4ff4efbacf8323799cec72c41bdb91995b5615a2f6e2d6e

See more details on using hashes here.

File details

Details for the file pyqrack_complex128-1.80.4-py3-none-win_amd64.whl.

File metadata

File hashes

Hashes for pyqrack_complex128-1.80.4-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 fe03bd63ab5cecf82efe3444b099e831a1eb544a70f07e3aacb4d1d8cdb4315a
MD5 4dafc672e8f19d2c6e0612a41dca254e
BLAKE2b-256 16c4e919b6d58abe185c2a9d5e1d59dc96026d856fc09e3623ac74baaca7aa0d

See more details on using hashes here.

File details

Details for the file pyqrack_complex128-1.80.4-py3-none-manylinux_2_39_x86_64.whl.

File metadata

File hashes

Hashes for pyqrack_complex128-1.80.4-py3-none-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 42c6278aaa894660c25e9365a232ecea034bf55b55dca834d4ab9e13f02eec4c
MD5 6bb6e07757ca3dab5c69ff2a28f168d5
BLAKE2b-256 e73d17770d8189e92805b5933e7916978ca9e3c7798a9ec34864663031c901f3

See more details on using hashes here.

File details

Details for the file pyqrack_complex128-1.80.4-py3-none-manylinux_2_35_x86_64.whl.

File metadata

File hashes

Hashes for pyqrack_complex128-1.80.4-py3-none-manylinux_2_35_x86_64.whl
Algorithm Hash digest
SHA256 bfc9a0bd4d8fdc8024b26690f10c1cd30f98111c7c31b8f3f43949c117ec2b09
MD5 5b71f667d67172c4102886c0d07e39c5
BLAKE2b-256 7a53acf83692a3d2b079b91706109ed47e5335886c4879b23023eb495c8075a7

See more details on using hashes here.

File details

Details for the file pyqrack_complex128-1.80.4-py3-none-macosx_15_0_x86_64.whl.

File metadata

File hashes

Hashes for pyqrack_complex128-1.80.4-py3-none-macosx_15_0_x86_64.whl
Algorithm Hash digest
SHA256 e0295a0badd5283cf23f4905c596c05068634b68d2443eeb86a5cc7a72b435ea
MD5 365642f6ac53660133269dbec34d623b
BLAKE2b-256 cfed6e15b1444710f9a684958f91dc23caa444d375e09a2ab1f6ac8f96868362

See more details on using hashes here.

File details

Details for the file pyqrack_complex128-1.80.4-py3-none-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for pyqrack_complex128-1.80.4-py3-none-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 cbbdca1a46d691da65d55e0ad1ef8eef4404c992b2fec52b5c86549b1768d6b7
MD5 c602c47875f9a7a5b0aea52798287527
BLAKE2b-256 8633eae0a7117462323dbc54e40344aafa1da31563a2a8f9011d32742de99f0a

See more details on using hashes here.

File details

Details for the file pyqrack_complex128-1.80.4-py3-none-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for pyqrack_complex128-1.80.4-py3-none-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 2e24a945cba36ef4c765e1c2fbb0dea1d015cae9a0d3a54fab954cc364291102
MD5 f4de99932fde3c6098e1b9d3b2178ec5
BLAKE2b-256 def26387078965ebcc2e1ab76dd0e0e4b0b1e5e63441c61c421bac82cd9fe71d

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