Useful and "cool" example scripts for PyQrack
PyQrack is the official Python wrapper for the (C++) Qrack quantum computer simulator and framework. Examples already exist as a Jupyter Notebook collection.
Most people with interest in quantum computing would probably be happy to consume PyQrack via Jupyter Notebook and Jupyter Lab. However, while Qrack recognizes and supports that popular ("data science") workflow, relying on so many development environment and runtime dependencies is, basically, antithetical to the original point and design of the Qrack project. Qrack has no required dependencies whatsoever, except for the C ABI, libc6
, as a dependency of any C or C++ "pure-language" code project. Qrack optionally provides GPU acceleration via choice of OpenCL or CUDA, but even this is an optional dependency that can be omitted. 128-bit floating point math can optionally be supplied by the Boost libraries, but even Qrack's ("big integers") "arbitrary precision integers," when demanded according to user build settings, is "pure language standard."
You can understand, Qrack prides itself on a comparatively tiny, secure, self-sufficient "supply chain." While we certainly don't object to "more typical" workflow "supply chains," with large, cascading dependency trees across the Python ecosystem, we should supply examples and applications that work in a minimalist development environment. Hence, besides C++ Qrack examples in the library repository itself, we provide these Python script examples as well, with minimal dependencies.
Clone this repository:
$ git clone htttps://github.com/vm6502q/pyqrack-examples.git
If this doesn't work, you might need to install git
, first.
Install PyQrack. On Ubuntu, you can use the official system package:
$ sudo add-apt-repository ppa:wrathfulspatula/vm6502q
$ sudo apt update
$ sudo apt install pyqrack
Otherwise, if the Ubuntu package won't work with your system, you can use pip
:
$ python3 -m pip3 install pyqrack
or, depending on your environment, this is the basic idea:
$ pip install pyqrack
That's it! To run any of the scripts in this repository, just invoke the Python interpreter! For example, this script times a random circuit sampling benchmark:
$ python3 rcs.py