quantsim_core
A pure Rust library for quantum circuit simulation. This crate provides the core simulation engine for quantum computing, designed to be portable and reusable without any UI dependencies.
Features
- Pure Rust Implementation: No UI dependencies, making it suitable for integration into any Rust project
- Comprehensive Gate Library: Support for standard quantum gates including single-qubit, multi-qubit, and parametric gates
- Custom Gate Support: Define your own unitary gates programmatically
- Embedded Circuit Templates: Built-in quantum algorithm examples (Bell states, Grover's algorithm, QFT, etc.)
- Parallel Execution: Uses Rayon for efficient parallelization of computationally intensive operations
- Introspection API: Detailed per-timestep snapshots of quantum state evolution
- JSON Serialization: Easy circuit persistence and sharing
Usage
Add this to your Cargo.toml:
[]
= "0.1.0"
Basic Example
use ;
let mut registry = new;
registry.register_standard_gates;
// Create a Bell state circuit
let mut circuit = new;
circuit.add_gate.unwrap;
circuit.add_gate.unwrap;
// Simulate
let mut engine = new;
let result = engine.run.unwrap;
println!;
Loading Built-in Templates
use circuits;
let bell_circuit = load_template.unwrap;
Architecture
The library is organized into several key modules:
circuit: Quantum circuit representation and manipulationengine: Simulation execution enginegates: Gate definitions and registry systemtypes: Core data types and representationscircuits: Built-in circuit templates
Performance
- Parallel gate application using Rayon
- Efficient state vector representation
- Optimized for both small educational circuits and larger quantum algorithms
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.