17 releases (breaking)

Uses old Rust 2015

0.13.0 Oct 19, 2024
0.11.2 Aug 4, 2024
0.10.0 Apr 22, 2024
0.9.0 Sep 10, 2023
0.4.0 Mar 30, 2023

#45 in Emulators

Download history 4/week @ 2024-07-23 297/week @ 2024-07-30 43/week @ 2024-08-06 3/week @ 2024-08-13 22/week @ 2024-09-10 10/week @ 2024-09-17 41/week @ 2024-09-24 112/week @ 2024-10-01 27/week @ 2024-10-08 166/week @ 2024-10-15 17/week @ 2024-10-22

186 downloads per month

MIT license

155KB
1.5K SLoC

qook

Pure language standard, "safe" Rust bindings for the pure C++11/OpenCL Qrack quantum computer simulator library

(Qook is just pure Qrack.)

To use this package, it's helpful to be familiar with unitaryfund/qrack. Users gain much more control over options by building unitaryfund/qrack from source.

You must install the Qrack library in order to use this library crate. (See the Qrack releases page for details.) cargo will dynamically link qook against your system installation of Qrack.

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 an array of 8 (real) floating point numbers, grouped in immediate pairs of real then imaginary components of complex numbers, then in row-major order.

Primitive and vector "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 the Rust vector 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.

The Qrack installation binary directory contains a qrack_cl_precompile executable for your platform, to compile OpenCL kernels once, beforehand, avoiding the need to recompile "just-in-time" every time that you load this library in a binary executable. If you no longer want to use precompiled kernels, or if precompilation fails, just delete the ~/.qrack directory, or the equivalent .qrack sub-directory in the user home folder of your operating system.

The API is meant to exactly mirror (Python-based) PyQrack. See https://pyqrack.readthedocs.io/en/latest/ for an API reference.

Please feel welcome to open an issue, if you'd like help. 😃

For their work on PyQrack, 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!

Dependencies

~0–1.9MB
~37K SLoC