Installation
Run this in your terminal
OR add this to your Cargo.toml:
[]
= "0.3.2"
Quick Start
use ;
Features
Quantum Bits (Qubits)
Comprehensive support for quantum state representation and manipulation
Example
use ;
use Complex;
// Create basis states
let zero = zero; // |0⟩ state
let one = one; // |1⟩ state
// Create superposition states
let alpha = new;
let beta = new;
let superposition = new; // |+⟩ state
// Apply quantum gates
let mut qubit = zero;
qubit.apply; // Apply Pauli-X (NOT) gate
qubit.apply; // Apply Hadamard gate
// Measure probabilities
let p0 = qubit.probability_zero;
let p1 = qubit.probability_one;
Quantum Gates
Implementation of fundamental quantum gates with their matrix representations
use QuantumGate;
// Pauli gates
let x_gate = X; // Pauli-X (quantum NOT)
let y_gate = Y; // Pauli-Y
let z_gate = Z; // Pauli-Z
// Phase gates
let s_gate = S; // S gate (√Z)
let t_gate = T; // T gate (π/4 phase)
// Hadamard gate
let h_gate = H; // Creates superposition
State Visualization
Dirac notation formatting for quantum states
use Qubit;
let qubit = zero;
println!; // Prints: |ψ⟩ = |0⟩
let qubit = one;
println!; // Prints: |ψ⟩ = |1⟩
// For superposition states
let alpha = new;
let beta = new;
let superposition = new;
println!; // Prints: |ψ⟩ = (0.7071067811865475+0i)|0⟩ + (0.7071067811865475+0i)|1⟩
License
This project is licensed under the Apache-2.0 License - see the LICENSE file for details.