pub struct QAOABenchmark { /* private fields */ }Expand description
QAOA benchmark
Implementations§
Source§impl QAOABenchmark
impl QAOABenchmark
Sourcepub fn new(num_qubits: usize, num_layers: usize, problem_size: usize) -> Self
pub fn new(num_qubits: usize, num_layers: usize, problem_size: usize) -> Self
Examples found in repository?
examples/comprehensive_benchmarking_demo.rs (line 58)
27fn main() -> Result<()> {
28 println!("=== Comprehensive Quantum ML Benchmarking Demo ===\n");
29
30 // Step 1: Initialize benchmarking framework
31 println!("1. Initializing benchmarking framework...");
32
33 let config = BenchmarkConfig {
34 repetitions: 3,
35 warmup_runs: 1,
36 max_time_per_benchmark: 60.0, // 1 minute per benchmark
37 profile_memory: true,
38 analyze_convergence: true,
39 confidence_level: 0.95,
40 ..Default::default()
41 };
42
43 let mut framework = BenchmarkFramework::new().with_config(config);
44
45 println!(" - Framework initialized");
46 println!(" - Output directory: benchmark_results/");
47 println!(" - Repetitions per benchmark: 3");
48
49 // Step 2: Register benchmarks
50 println!("\n2. Registering benchmarks...");
51
52 // VQE benchmarks for different qubit counts
53 framework.register_benchmark("vqe_4q", Box::new(VQEBenchmark::new(4, 8)));
54 framework.register_benchmark("vqe_6q", Box::new(VQEBenchmark::new(6, 12)));
55 framework.register_benchmark("vqe_8q", Box::new(VQEBenchmark::new(8, 16)));
56
57 // QAOA benchmarks
58 framework.register_benchmark("qaoa_4q", Box::new(QAOABenchmark::new(4, 2, 8)));
59 framework.register_benchmark("qaoa_6q", Box::new(QAOABenchmark::new(6, 3, 12)));
60
61 // QNN benchmarks
62 framework.register_benchmark("qnn_4q", Box::new(QNNBenchmark::new(4, 2, 100)));
63 framework.register_benchmark("qnn_6q", Box::new(QNNBenchmark::new(6, 3, 100)));
64
65 println!(" - Registered 7 benchmarks total");
66
67 // Step 3: Create backend configurations
68 println!("\n3. Setting up backends...");
69
70 let backends = create_benchmark_backends();
71 let backend_refs: Vec<&Backend> = backends.iter().collect();
72
73 println!(" - Created {} backends", backends.len());
74 for backend in &backends {
75 println!(" - {}", backend.name());
76 }
77
78 // Step 4: Run all benchmarks
79 println!("\n4. Running all benchmarks...");
80
81 framework.run_all_benchmarks(&backend_refs)?;
82
83 println!(" - All benchmarks completed");
84
85 // Step 5: Generate and display report
86 println!("\n5. Generating benchmark report...");
87
88 let report = framework.generate_report();
89 println!("\n{}", report.to_string());
90
91 // Step 6: Print detailed results
92 println!("\n6. Detailed Results Analysis:");
93
94 // Get results again for analysis since we can't hold onto the reference
95 let results = framework.run_all_benchmarks(&backend_refs)?;
96 print_performance_summary(results);
97 print_scaling_analysis(results);
98 print_memory_analysis(results);
99
100 println!("\n=== Comprehensive Benchmarking Demo Complete ===");
101
102 Ok(())
103}Trait Implementations§
Source§impl Benchmark for QAOABenchmark
impl Benchmark for QAOABenchmark
Source§fn description(&self) -> &str
fn description(&self) -> &str
Get benchmark description
Source§fn run(&mut self, _backend: &Backend) -> Result<BenchmarkRunResult>
fn run(&mut self, _backend: &Backend) -> Result<BenchmarkRunResult>
Run single benchmark iteration
Source§fn expected_scaling(&self) -> ScalingType
fn expected_scaling(&self) -> ScalingType
Get expected scaling behavior
Source§fn category(&self) -> BenchmarkCategory
fn category(&self) -> BenchmarkCategory
Get benchmark category
Auto Trait Implementations§
impl Freeze for QAOABenchmark
impl RefUnwindSafe for QAOABenchmark
impl Send for QAOABenchmark
impl Sync for QAOABenchmark
impl Unpin for QAOABenchmark
impl UnwindSafe for QAOABenchmark
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.