1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
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));
}
|