Files
quantum-bridge-mcp/vendor/spinoza/examples/h.rs
T
Vincent Bourdon 9af114e391 Initial import
2026-06-09 16:14:55 +02:00

30 lines
669 B
Rust

use clap::Parser;
use spinoza::{
config::{Config, QSArgs},
core::{State, CONFIG},
gates::{apply, Gate},
utils::{pretty_print_int, to_table},
};
fn h(n: usize, show_results: bool) {
let now = std::time::Instant::now();
let mut state = State::new(n);
for t in 0..n {
apply(Gate::H, &mut state, t);
}
let elapsed = now.elapsed().as_micros();
println!("{}", pretty_print_int(elapsed));
if show_results {
println!("{}", to_table(&state));
}
}
fn main() {
let args = QSArgs::parse();
let config = Config::from_cli(args);
CONFIG.set(config).unwrap();
h(config.qubits.into(), config.print);
}