QuEST Rust Wrapper
Introduction
The Quantum Exact Simulation Toolkit is a high performance simulator of universal quantum circuits, state-vectors and density matrices. QuEST is written in C, hybridises OpenMP and MPI, and can run on a GPU. Needing only compilation, QuEST is easy to run both on laptops and supercomputers (in both C and C++), where it can take advantage of multicore, GPU-accelerated and networked machines to quickly simulate circuits on many qubits.
This library provides a safe wrapper around QuEST with an idiomatic Rust API.
Usage
To use quest-rs in your Rust codebase, first run:
or add quest-rs
manually to your Cargo.toml
.
The API is simple:
use ;
let env = new;
let mut qubits = new;
qubits.init_plus_state.hadamard.controlled_not;
println!;
qubits.measure;
println!;
The fluent API makes more complicated circuits easy to create:
use ;
let env = new;
let mut qubits = new;
qubits.init_zero_state;
println!;
qubits.report_params;
env.report;
// Set up the circuitry
let unitary_alpha = new;
let unitary_beta = new;
let unitary_matrix = ComplexMatrix2 ;
let mut toffoli_gate = new;
for i in 0..6
toffoli_gate.set_real;
toffoli_gate.set_real;
qubits
.hadamard
.controlled_not
.rotate_y
.multi_controlled_phase_flip
.unitary
.compact_unitary
.rotate_around_axis
.controlled_compact_unitary
.multi_controlled_unitary
.multi_qubit_unitary;
// Study the output
println!;
println!;
println!;
println!;
println!;
let = qubits.measure_with_stats;
println!;
Template
For a starter template to get going with an executable project that uses this wrapper, see: https://github.com/drewsilcock/quest-rs-template.
Todo
The C QuEST library has several compile-option flags which should be supported using cargo features. These are:
- what precision to operate in (single, double or quad)
- whether to enable OpenMP, MPI, OpenMP+MPI or GPU
The documentation should also be expanded to include all the relevant info from the QuEST documentation.