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.67.0.tar.gz (49.5 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.67.0-py3-none-win_amd64.whl (916.9 kB view details)

Uploaded Python 3Windows x86-64

pyqrack_complex128-1.67.0-py3-none-manylinux_2_39_x86_64.whl (3.1 MB view details)

Uploaded Python 3manylinux: glibc 2.39+ x86-64

pyqrack_complex128-1.67.0-py3-none-manylinux_2_35_x86_64.whl (3.1 MB view details)

Uploaded Python 3manylinux: glibc 2.35+ x86-64

pyqrack_complex128-1.67.0-py3-none-macosx_15_0_arm64.whl (1.8 MB view details)

Uploaded Python 3macOS 15.0+ ARM64

pyqrack_complex128-1.67.0-py3-none-macosx_14_0_arm64.whl (1.8 MB view details)

Uploaded Python 3macOS 14.0+ ARM64

pyqrack_complex128-1.67.0-py3-none-macosx_13_0_x86_64.whl (2.0 MB view details)

Uploaded Python 3macOS 13.0+ x86-64

File details

Details for the file pyqrack_complex128-1.67.0.tar.gz.

File metadata

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

File hashes

Hashes for pyqrack_complex128-1.67.0.tar.gz
Algorithm Hash digest
SHA256 767cba003881b4cf543ca71628199832ffff554459958453f517b2e81b41b317
MD5 60083b76944eafee8234870ef7983390
BLAKE2b-256 09f364e5045e9bd83cda448827c272a86d33885e54dbd66c46f6de5b77c0cfa1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack_complex128-1.67.0-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 2fb6dca4f094ddb6869f10fe1ba9f28337a498a06de7d0bfcd6ac2599bdbc6fb
MD5 857b70db686cb2b99ae45557d2875f21
BLAKE2b-256 8dd7b49261893c8f0df6a2baa40a03eeda4f1d9f0e520553efb3a755c1b17c13

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack_complex128-1.67.0-py3-none-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 0491310e076f7e63c349f397c3057b15be10d0df81d7da9f67773d5cae5d5b95
MD5 82f9b4cf6eedd5badf30024c28b21ae6
BLAKE2b-256 18c269dcb188ca7a16b76cc8146cb8e8a5d3a639aec44857f85673ab66e371a4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack_complex128-1.67.0-py3-none-manylinux_2_35_x86_64.whl
Algorithm Hash digest
SHA256 155f27f9f348d4b6e617465406600451f79a7a9923eb14719c9090a2b892e1f8
MD5 9c02a253e5c133c24a8e5d46abf71814
BLAKE2b-256 c036bca05b6b290b0f98fb4de54e352a8821a458237149b27a3da2a0353a2c83

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack_complex128-1.67.0-py3-none-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 68e5736aedfe41acf08b4a5e5fceb44d3cca1f3e25a324735c14b9399072d591
MD5 490ec4378bb84bc52991131a8d0dcb42
BLAKE2b-256 41be8e8a1118a3a92873826a73fe8a84ad386bc79fd317b5b933452fcbaa7b7b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack_complex128-1.67.0-py3-none-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 73cfbc7b5900c46323aff44f42587f38fff6914e80440276f6f9892844bc0cf7
MD5 29dcf5d0a5d75ee0a8981cc28e36772c
BLAKE2b-256 e6e682a7b7d6ef01e1166be9c64b4d644530bc71cc950a2043ecaf412b2b9d85

See more details on using hashes here.

File details

Details for the file pyqrack_complex128-1.67.0-py3-none-macosx_13_0_x86_64.whl.

File metadata

File hashes

Hashes for pyqrack_complex128-1.67.0-py3-none-macosx_13_0_x86_64.whl
Algorithm Hash digest
SHA256 d1cc1352e9f5e3251cdd30522f5a6f20581d3267f9c548570adfe45f626f191b
MD5 306b553212b0d688e5c8fa375c201a43
BLAKE2b-256 762622d86a3bc471a4009e2c986be6010a804e5f5184ae60e34f10ce60ed7623

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