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

Uploaded Source

Built Distributions

pyqrack-1.32.29-py3-none-win_amd64.whl (868.9 kB view details)

Uploaded Python 3 Windows x86-64

pyqrack-1.32.29-py3-none-manylinux_2_39_x86_64.whl (2.8 MB view details)

Uploaded Python 3 manylinux: glibc 2.39+ x86-64

pyqrack-1.32.29-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.29-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.29-py3-none-macosx_15_0_arm64.whl (1.6 MB view details)

Uploaded Python 3 macOS 15.0+ ARM64

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

Uploaded Python 3 macOS 14.0+ ARM64

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

File metadata

  • Download URL: pyqrack-1.32.29.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.29.tar.gz
Algorithm Hash digest
SHA256 25a3248f1a6180ca47cc1324f4d7cbbb013d9717a8cb7a48d2efce2f4303c4d3
MD5 95020cf1c96168b9f1c491e71c595072
BLAKE2b-256 786d3a591774e037d0834a113e47b14e3a175a69e4f5afcc7425efcec2cd62fa

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pyqrack-1.32.29-py3-none-win_amd64.whl
  • Upload date:
  • Size: 868.9 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.29-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 12e480e5676e3f0b4678ad15023640cfafbeacaf4182554b2025fbe9c1f21268
MD5 29dab12bbc6c656150fa2c70f6e36a89
BLAKE2b-256 d1c72ce7d5551e959638ea2c1c01278878acc0cc517e05f02a09eb57eb663523

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack-1.32.29-py3-none-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 50edc5fe288e4e5c05df64a0e24a057ac742f93db05c80324a67c832938a3125
MD5 0b47a1c72368df924efd407647d1ae38
BLAKE2b-256 d090645244fcff57b686fcf1b704669f868d650cc9bc69b3fde06813686f7e00

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack-1.32.29-py3-none-manylinux_2_35_x86_64.whl
Algorithm Hash digest
SHA256 d4f5a79611c2e8886d333ba12b93bd5688b236a576d75aae57fa6a4d79739cfe
MD5 dd50b83b27db29beba75277658c34017
BLAKE2b-256 f2ab02cd066b13b54add67b4593c3462e1c03d713785724f9d6816c8f12c189b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack-1.32.29-py3-none-manylinux_2_31_x86_64.whl
Algorithm Hash digest
SHA256 7a934e4829347fcd4fe2d51d7251ed48472dacd9f5b6a3d25230129eefbc5737
MD5 0ea318101c9755ca25560fb2562e8b37
BLAKE2b-256 b7e9776f4c4126d868561bd0268030e2fe50ada2416d4a5da472323539c6e39b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack-1.32.29-py3-none-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 62a49ace75ec824b3186489d558827a68020a8715ad394e552c569f8fbc7bd1e
MD5 344d9f1f4a0086856a5bd32143c70eda
BLAKE2b-256 8d07c2a9b1a883ff1ce12944b289de76d177ac7e1bd37d707e4bbe646144be1e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack-1.32.29-py3-none-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 e5dd6f7eba19ce0bedb22b831e706cca95079dfe64006f45ee0eb95cd816eea5
MD5 fa5024ce97e1f70d6dac19fea5ed007c
BLAKE2b-256 c6fd06ebb8573b677093a19b62b9946c56d23722a68f28b39546bfe6177718b9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyqrack-1.32.29-py3-none-macosx_13_0_x86_64.whl
Algorithm Hash digest
SHA256 c471a234b418bd56a041c6406ea924bc11b7d76c441af700bae99c4a37914334
MD5 3e0a0df82e5c2651a2cd9761c9cd89cd
BLAKE2b-256 31f2d090c60de5c4781027b6a59a3a447cee07b12d49122b5367a02427358371

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