diff options
| author | hachem <im@hachem.wtf> | 2026-08-29 03:55:18 +0200 |
|---|---|---|
| committer | hachem <im@hachem.wtf> | 2026-08-29 03:55:18 +0200 |
| commit | 94612a0be0e691d68bcd27a33e529ad30fa3df43 (patch) | |
| tree | 8d93b8d03ffa3170e07c10cd86b2366c9ca7a30c /tester/benchmarks.rs | |
| parent | a159f48900f1927b05d4b8f3d04459610eb9897e (diff) | |
add: complex numbers
Diffstat (limited to 'tester/benchmarks.rs')
| -rw-r--r-- | tester/benchmarks.rs | 90 |
1 files changed, 90 insertions, 0 deletions
diff --git a/tester/benchmarks.rs b/tester/benchmarks.rs new file mode 100644 index 0000000..7aea535 --- /dev/null +++ b/tester/benchmarks.rs @@ -0,0 +1,90 @@ +use crate::common::{benchmark_circuit, print_section, BenchmarkResult}; +use psi::QuantumCircuit; +use psi::HorizontalRenderer; + +pub fn run_all(results: &mut Vec<BenchmarkResult>) { + println!("═══════════════════════════════════════════════════════════════"); + println!(" BENCHMARK CIRCUITS"); + println!("═══════════════════════════════════════════════════════════════\n"); + + test_8_qubit(results); + test_10_qubit(results); + test_12_qubit(results); + test_14_qubit(results); +} + +pub fn test_8_qubit(results: &mut Vec<BenchmarkResult>) { + print_section("8-qubit Entangled Circuit"); + + let builder = || { + let mut circuit = QuantumCircuit::new(8); + for i in 0..8 { + circuit.h(i); + } + for i in 0..7 { + circuit.cnot(i, i + 1); + } + circuit + }; + + println!("{}", HorizontalRenderer::new(&builder())); + results.push(benchmark_circuit("8-qubit entangled", builder)); +} + +pub fn test_10_qubit(results: &mut Vec<BenchmarkResult>) { + print_section("10-qubit Entangled Circuit"); + + let builder = || { + let mut circuit = QuantumCircuit::new(10); + for i in 0..10 { + circuit.h(i); + } + for i in 0..9 { + circuit.cnot(i, i + 1); + } + circuit.cz(0, 9); + circuit + }; + + println!("{}", HorizontalRenderer::new(&builder())); + results.push(benchmark_circuit("10-qubit entangled", builder)); +} + +pub fn test_12_qubit(results: &mut Vec<BenchmarkResult>) { + print_section("12-qubit Entangled Circuit"); + + let builder = || { + let mut circuit = QuantumCircuit::new(12); + for i in 0..12 { + circuit.h(i); + } + for i in 0..11 { + circuit.cnot(i, i + 1); + } + circuit.cz(0, 11); + circuit.swap(5, 6); + circuit + }; + + println!("{}", HorizontalRenderer::new(&builder())); + results.push(benchmark_circuit("12-qubit entangled", builder)); +} + +pub fn test_14_qubit(results: &mut Vec<BenchmarkResult>) { + print_section("14-qubit Entangled Circuit"); + + let builder = || { + let mut circuit = QuantumCircuit::new(14); + for i in 0..14 { + circuit.h(i); + } + for i in 0..13 { + circuit.cnot(i, i + 1); + } + circuit + }; + + println!("{}", HorizontalRenderer::new(&builder())); + results.push(benchmark_circuit("14-qubit entangled", builder)); +} + |
