1use wai_quantum::quantum::{circuit_hash, Circuit};
7use wai_quantum::quantum_toolchain as qt;
8
9fn main() {
10 let mut c = Circuit::new(2);
13 c.h(0).cx(0, 1); let sv = c.simulate().expect("simulate");
16 let id = circuit_hash(&c).expect("a valid circuit has a hash");
19
20 println!("circuit {} qubits, {} gates, {}", c.n_qubits, c.ops.len(), c.gateset.capability());
21 print!("circuit-id ");
22 for b in id {
23 print!("{b:02x}");
24 }
25 println!();
26 let (backend, why) = qt::recommend_backend(&c);
27 println!("backend {backend:?} — {why}");
28
29 println!("outcomes");
30 for (state, p) in qt::top_outcomes(&sv, 4) {
31 if p > 0.0 {
32 println!(" |{state:02b}> {p:.6}");
33 }
34 }
35
36 let h = sv.statevector_hash();
39 print!("state-hash ");
40 for b in h {
41 print!("{b:02x}");
42 }
43 println!();
44}