pub trait LiveExecution {
// Required methods
fn compute_gate(&mut self, gate: &GateInstruction) -> Result<(), KetError>;
fn compute_native_gates(
&mut self,
gates: &[NativeGate],
) -> Result<(), KetError>;
fn measure(&mut self, qubits: &[usize]) -> Result<u64, KetError>;
fn dump(&mut self, qubits: &[usize]) -> Result<DumpData, KetError>;
fn sample(
&mut self,
qubits: &[usize],
shots: usize,
) -> Result<SampleData, KetError>;
fn exp_value(&mut self, hamiltonian: Hamiltonian) -> Result<f64, KetError>;
}Expand description
A backend that executes gates as they arrive and can return mid-circuit measurement results immediately.
Required Methods§
Sourcefn compute_gate(&mut self, gate: &GateInstruction) -> Result<(), KetError>
fn compute_gate(&mut self, gate: &GateInstruction) -> Result<(), KetError>
Sourcefn compute_native_gates(&mut self, gates: &[NativeGate]) -> Result<(), KetError>
fn compute_native_gates(&mut self, gates: &[NativeGate]) -> Result<(), KetError>
Dispatches a sequence of already-translated native gate instructions to the backend.
Called by the live-execution path when a NativeGateSet translation
layer is configured. The gates slice contains hardware-specific
instructions produced by NativeGateSet::translate or
NativeGateSet::cnot.
§Errors
Implementations may return a KetError if native gate dispatch fails.
Trait Implementations§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".