aboutsummaryrefslogtreecommitdiff
path: root/libpsi-core/src/runtimes/basic_rt.rs
blob: 78d6122cb38a1acdb40020123ee3ee02db95e106 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
use crate::{ClassicalRegister, ExecutationData, QuantumCircuit, Runtime, RuntimeBase};

pub struct BasicRT {
    circuit: QuantumCircuit,
}

impl RuntimeBase for BasicRT {
    fn get_circuit(&self) -> &QuantumCircuit {
        &self.circuit
    }
}

impl Runtime for BasicRT {
    fn new(circuit: QuantumCircuit) -> BasicRT {
        BasicRT { circuit }
    }

    fn execute(&self, repeat: usize) -> Vec<ExecutationData> {
        let mut result: Vec<ExecutationData> = Vec::with_capacity(repeat);
        for _ in 0..repeat {
            let executation_data = ExecutationData::new(Vec::new(), ClassicalRegister::new(1));
            result.push(executation_data);
        }
        result
    }
}