everett
A clean, zero-dependency statevector quantum simulator in Rust.
everett represents the quantum state of n qubits as a complex vector of
dimension 2^n and applies gates in place over amplitude index-groups, never
by materializing a 2^n x 2^n matrix. The name is a nod to the many-worlds
interpretation: a statevector holds the entire branching wavefunction at once.
Example
use *;
// prepare a Bell state: (|00> + |11>) / sqrt(2)
let mut circuit = new;
circuit.h.cnot;
let state = run?;
assert!;
assert!;
# Ok::
What's included (v1)
- A universal gate set (
H,X,Y,Z,S,T, rotations, phase) plus two-qubit gates (CNOT,CZ,SWAP) and arbitrary controlled gates. - Projective measurement with Born-rule sampling and mid-circuit, classically-controlled operations.
- Worked algorithms: Bell/GHZ state preparation, teleportation, superdense coding, the quantum Fourier transform, phase estimation, and Hamiltonian simulation via Trotterization.
Development
This project uses Nix flakes. The default shell provides the stable toolchain; separate shells provide the nightly toolchain for Miri and the Kani verifier.
Without Nix, a standard cargo toolchain (1.95+) works for everything except
the Miri and Kani steps.
License
Licensed under either of Apache License, Version 2.0 or MIT license at your option.