everett
A clean, zero-dependency statevector quantum simulator in Rust.
everett represents the quantum state of n qubits as a complex vector of
2^n amplitudes and applies gates in place over amplitude index-groups, never
by materializing a full 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 *;
// Bell state: (|00> + |11>) / sqrt(2)
let mut circuit = new;
circuit.h.cnot;
let exec = run?;
let state = exec.state;
assert!;
assert!;
# Ok::
Features
Three backends
| Backend | State representation | Best for |
|---|---|---|
StateVectorBackend |
2^n amplitudes |
general simulation up to ~30 qubits |
DensityMatrixBackend |
4^n density matrix |
noise simulation, mixed states |
StabilizerBackend |
O(n^2) tableau |
Clifford circuits on hundreds of qubits |
Gate set -- single-qubit: H, X, Y, Z, S, T, Rx/Ry/Rz,
Phase; two-qubit: CNOT, CZ, SWAP; plus arbitrary controlled gates.
Measurement -- projective measurement with Born-rule sampling and mid-circuit classically-controlled operations.
Noise -- uniform depolarizing, Kraus-operator channels, and readout errors
via NoiseModel, applied through DensityMatrixBackend.
OpenQASM 3.0 -- import and export circuits with Circuit::from_qasm /
Circuit::to_qasm.
Algorithms -- Bell/GHZ state preparation, quantum teleportation, superdense coding, quantum Fourier transform, phase estimation, and Hamiltonian simulation via Trotterization.
Optional: parallelism
Gate application can be parallelized across amplitude chunks with rayon. This is off by default to keep the core dependency-free and Miri-friendly.
= { = "0.1", = ["parallel"] }
Development
This project uses Nix flakes. The default shell provides the stable toolchain; separate shells provide nightly for Miri and the Kani verifier.
Without Nix, a standard cargo toolchain (1.85+) works for everything except
Miri and Kani.
License
Licensed under either of Apache License, Version 2.0 or MIT license at your option.