diff options
| author | hachem <im@hachem.wtf> | 2024-10-18 09:34:36 +0200 |
|---|---|---|
| committer | hachem <im@hachem.wtf> | 2024-10-18 09:34:36 +0200 |
| commit | 5f058c9b67e0f96e0dd89bbeff0afe8e08bde25b (patch) | |
| tree | 7546702edc4d6e2c66c1440753c31387b38dea9f /tester/src/main.rs | |
| parent | 7cc3c78a24b51a58d44e1baff20b86292662390e (diff) | |
Allow named registers and tiny refactor
Diffstat (limited to 'tester/src/main.rs')
| -rw-r--r-- | tester/src/main.rs | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/tester/src/main.rs b/tester/src/main.rs index 3840c23..2c2e72c 100644 --- a/tester/src/main.rs +++ b/tester/src/main.rs @@ -1,15 +1,15 @@ use libpsi_core::*; -use libpsi_visualizer::*; fn main() { - let mut circuit = QuantumCircuit::new(2, 2); - circuit.execute(Instruction::ApplyGate(&gates::HADAMARD, &[], 0)); - circuit.execute(Instruction::ApplyGate(&gates::CNOT, &[0], 1)); - circuit.execute(Instruction::ApplyGate(&gates::HADAMARD, &[], 0)); + let quantum_registers = [ + QuantumRegister::new("qr0", &["q0", "q1", "q2", "q3"]), + QuantumRegister::new("qr1", &["k0", "k1", "k2", "k3"]), + ]; - circuit.execute(Instruction::Measure(0)); - circuit.execute(Instruction::Measure(1)); + let classical_registers = [ + ClassicalRegister::new("cr0", &["c0", "c1", "c2", "c3"]), + ClassicalRegister::new("cr1", &["a0", "a1", "a2", "a3"]), + ]; - HorizontalCLIVisualizer::new(&circuit).render(); - BasicRT::new(&circuit).execute(1024); + QuantumCircuit::new(&quantum_registers, &classical_registers); } |
