This project is a toy quantum statevector simulator written in Rust. It implements a simple linear algebra backend (complex numbers and matrices) and builds on top of it a small framework for representing and simulating quantum circuits using statevectors.
- Linear algebra support for complex valued matrices
- Identity, tensor (Kronecker) product, dagger (conjugate) transpose, permutation, and unitary check
- Common gate primitives (X, Y, Z, H, Rx, Ry, Rz) and projectors (
$|0\rangle\langle 0|$ ,$|1\rangle\langle 1|$ )
- Representation of single and multi-qubit gates within a circuit
- Supports controlled gates (CX, CY, CZ, and Toffoli)
- Gate expansion into the full Hilbert space via tensor products
- Build circuits with any number of qubits
- Add gates
- Compile into unitary operations
- Run to simulate the final statevector
fn main() {
let mut qc = Circuit::new(2, 0);
qc.h(0);
qc.cx(0, 1);
qc.compile();
qc.run().print();
}Matrix (4 x 1):
-----------------------
| 0.707+ 0.000i |
| 0.000+ 0.000i |
| 0.000+ 0.000i |
| 0.707+ 0.000i |
-----------------------fn main() {
let mut qc = Circuit::new(2, 0);
for q in qc.iter() { qc.h(q) ;}
for q in qc.iter() { qc.cx(q, q + 1);}
qc.compile();
qc.run().print();
}Matrix (4 x 1):
-----------------------
| 0.500+ 0.000i |
| 0.500+ 0.000i |
| 0.500+ 0.000i |
| 0.500+ 0.000i |
------------------------ Support basic Complex Arithmetic
- Support basic Matrix Algebra
- Single Qubit Gate Support
- Multi Qubit Gate Support
- Measurement
- Add Noisy Model Support
- Parrelisation
- Simplification
- Mid-circuit measurements