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

This version

2.0.0

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyqrack-2.0.0.tar.gz (56.2 kB view details)

Uploaded Source

Built Distributions

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

pyqrack-2.0.0-py3-none-win_amd64.whl (995.1 kB view details)

Uploaded Python 3Windows x86-64

pyqrack-2.0.0-py3-none-manylinux_2_39_x86_64.whl (3.6 MB view details)

Uploaded Python 3manylinux: glibc 2.39+ x86-64

pyqrack-2.0.0-py3-none-manylinux_2_35_x86_64.whl (3.7 MB view details)

Uploaded Python 3manylinux: glibc 2.35+ x86-64

pyqrack-2.0.0-py3-none-macosx_15_0_x86_64.whl (2.1 MB view details)

Uploaded Python 3macOS 15.0+ x86-64

pyqrack-2.0.0-py3-none-macosx_15_0_arm64.whl (1.9 MB view details)

Uploaded Python 3macOS 15.0+ ARM64

pyqrack-2.0.0-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-2.0.0.tar.gz.

File metadata

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

File hashes

Hashes for pyqrack-2.0.0.tar.gz
Algorithm Hash digest
SHA256 e88820f7df16070dcf395880aab8c3ed152e07fc72ebf227ed6fc6e66d63808f
MD5 e273dac2e5f9b051d68fdb77d056737f
BLAKE2b-256 a746f1674b42b552017fb827e7f4d6ff4d135cabe6bd790d00bd62fe1b2df738

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for pyqrack-2.0.0-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 0b2b2887a5bcaa803606633a6ccf5b37922968f3f80c464260996b64d68e5bbf
MD5 dba9cc16f7173456acaf4ecc313974aa
BLAKE2b-256 6152d5f350266fddf2c7a1fc8678b5906f4aecdd4b31e6ff5cdf360fc2fbec9e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack-2.0.0-py3-none-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 bef7b1caafabe9d5aa9900e59a0db3a7014e6f6fb6257e381ab64984a03c105e
MD5 8ca25ffe2e0fa19c3d7d1518496d1336
BLAKE2b-256 0361788e63ed879b06b858871d97db369a38cf9994c92bfc70397c7dde538d56

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack-2.0.0-py3-none-manylinux_2_35_x86_64.whl
Algorithm Hash digest
SHA256 55f2964af2059cb291d55126bb00675428072c053bc0cab7e366bc73f70a7710
MD5 ae3c16baf9b5c8307d636b5a2495d29c
BLAKE2b-256 152cc8db117bd48bb289f50bdcf03cc230d2db596471cb0ef6376c74da8fa05a

See more details on using hashes here.

File details

Details for the file pyqrack-2.0.0-py3-none-macosx_15_0_x86_64.whl.

File metadata

File hashes

Hashes for pyqrack-2.0.0-py3-none-macosx_15_0_x86_64.whl
Algorithm Hash digest
SHA256 c7fd8b15378afbc3ae10afdabbdc95f435e38170f81649c31a8f73f9d29b9f0e
MD5 6cb81d48b3a0067a7d7eb072063ea2f5
BLAKE2b-256 fb28f84e1767ab37ae0114d3456badfbf2bb918d1218cf7c0f08cdbdb7a978b6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack-2.0.0-py3-none-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 22d35cd3dece0fd2e485041643a88f6de222cd839ec92e7eff98610ced1e52da
MD5 b3fc86993ce670d9b35cc829eb93f622
BLAKE2b-256 df8a31e009a56ca258d3f654a1783bba85767876fb99d186385d7037f0ecf4a1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack-2.0.0-py3-none-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 f65ea6882f70d9e39af5fd2ba52af8de7605076884a03cff027bfeeb7e39aaf0
MD5 aac9c2eb71ad9b4da489668e4fcf9ca1
BLAKE2b-256 a95b80f5c1ce4772a6417a86ae0df4d6fac2d7cac13c2c523a0ce710c61b086b

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