quantsim
A quantum circuit simulator ecosystem providing both a core simulation library and a web-based graphical user interface.
Quick Start
Install and run the interactive simulator:
Or try the live web demo!
Architecture
This crate serves as the main entry point for the quantsim ecosystem, which consists of three components:
📦 quantsim (this crate)
- Library that re-exports the entire quantsim ecosystem
- Convenient entry point for accessing all functionality
- Reserves the quantsim name on crates.io
🧠quantsim_core
- Core simulation engine written in pure Rust
- Quantum gate library with built-in circuit templates
- Performance optimized with parallel execution
- No UI dependencies - portable and reusable
🎨 quantsim_ui
- WebAssembly-based GUI built with
egui - Interactive circuit builder with drag-and-drop gates
- Real-time visualization with Bloch spheres
- Built-in tutorials and comprehensive documentation
Installation
As a Binary Application
This installs the interactive simulator that you can run with:
As a Library Dependency
Add to your Cargo.toml:
[]
= "0.1.0"
Usage
Running the Interactive Simulator
This launches a web-based interface where you can:
- Build quantum circuits visually
- Run simulations with real-time results
- Explore built-in algorithm templates
- Learn with interactive tutorials
Using as a Library
use *;
// Create and simulate a quantum circuit
let mut circuit = new;
circuit.add_gate.unwrap;
circuit.add_gate.unwrap;
let engine = new;
let result = engine.run.unwrap;
println!;
WebAssembly UI (Advanced)
When targeting WASM, you can also access the UI components:
use ui;
// UI components available for custom web applications
Features
- Visual Circuit Design: Drag-and-drop quantum gate placement
- Real-time Simulation: Instant feedback on circuit execution
- Educational Tools: Interactive tutorials and documentation
- Performance: Parallel execution for large circuits
- Extensible: Custom gates and advanced simulation options
- Cross-platform: Runs in browsers via WebAssembly
Examples
Bell State Preparation
use *;
let mut circuit = new;
circuit.add_gate?; // Hadamard on qubit 0
circuit.add_gate?; // CNOT gate
let result = new.run?;
println!;
Loading Built-in Templates
use circuits;
let grover_circuit = load_template?;
let result = new.run?;
Documentation
Contributing
See the main repository for contribution guidelines.
License
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or https://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or https://opensource.org/licenses/MIT)
at your option.