From 7cc3c78a24b51a58d44e1baff20b86292662390e Mon Sep 17 00:00:00 2001 From: hachem Date: Sun, 13 Oct 2024 15:13:17 +0200 Subject: Mass refactor --- libpsi-core/src/runtimes/basic_rt.rs | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) (limited to 'libpsi-core/src/runtimes/basic_rt.rs') diff --git a/libpsi-core/src/runtimes/basic_rt.rs b/libpsi-core/src/runtimes/basic_rt.rs index 20befba..b8c412f 100644 --- a/libpsi-core/src/runtimes/basic_rt.rs +++ b/libpsi-core/src/runtimes/basic_rt.rs @@ -1,34 +1,39 @@ -use crate::{ExecutionData, QuantumCircuit, Runtime, RuntimeBase}; +use crate::{Instruction, QuantumCircuit, QuantumState, Runtime, RuntimeData}; pub struct BasicRT<'a> { - circuit: &'a QuantumCircuit, -} - -impl<'a> RuntimeBase for BasicRT<'a> { - fn get_circuit(&self) -> &QuantumCircuit { - &self.circuit - } + circuit: &'a QuantumCircuit<'a>, } impl<'a> Runtime<'a> for BasicRT<'a> { - fn new(circuit: &'a QuantumCircuit) -> BasicRT { + fn new(circuit: &'a QuantumCircuit) -> BasicRT<'a> { BasicRT { circuit } } - fn execute(&self, repeat: usize) -> Vec { - let mut result: Vec = Vec::with_capacity(repeat); + fn execute(&self, repeat: usize) -> Vec { + let mut result: Vec = Vec::with_capacity(repeat); for _ in 0..repeat { - let executation_data = ExecutionData::new( + let executation_data = RuntimeData::new( self.circuit.get_quantum_register(), self.circuit.get_classical_registers(), ); for instruction in self.circuit.get_instructions() { - println!("{} on q{}", instruction.gate.0, instruction.target_bit); + match instruction { + Instruction::ApplyGate(_gate, _control_bits, _target) => print!(""), + Instruction::Measure(_bit) => print!(""), + } } result.push(executation_data); } result } + + fn get_state(&self) -> QuantumState { + todo!() + } + + fn get_circuit(&self) -> &QuantumCircuit { + &self.circuit + } } -- cgit v1.3