blob: b8c412f98f42658a88b832330725b6e0d3432859 (
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
27
28
29
30
31
32
33
34
35
36
37
38
39
|
use crate::{Instruction, QuantumCircuit, QuantumState, Runtime, RuntimeData};
pub struct BasicRT<'a> {
circuit: &'a QuantumCircuit<'a>,
}
impl<'a> Runtime<'a> for BasicRT<'a> {
fn new(circuit: &'a QuantumCircuit) -> BasicRT<'a> {
BasicRT { circuit }
}
fn execute(&self, repeat: usize) -> Vec<RuntimeData> {
let mut result: Vec<RuntimeData> = Vec::with_capacity(repeat);
for _ in 0..repeat {
let executation_data = RuntimeData::new(
self.circuit.get_quantum_register(),
self.circuit.get_classical_registers(),
);
for instruction in self.circuit.get_instructions() {
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
}
}
|