pub struct QuantumSimulationBackend { /* private fields */ }Expand description
Backend for quantum circuit simulation.
This backend uses quantrs2_sim to execute quantum circuits and provides methods to convert results to PGM formats.
Implementations§
Source§impl QuantumSimulationBackend
impl QuantumSimulationBackend
Sourcepub fn with_config(config: SimulationConfig) -> Self
pub fn with_config(config: SimulationConfig) -> Self
Create with custom configuration.
Sourcepub fn execute_state(&self, num_qubits: usize) -> Result<SimulatedState>
pub fn execute_state(&self, num_qubits: usize) -> Result<SimulatedState>
Execute a quantum simulation with given number of qubits.
For now, this creates an initial state. Full circuit execution will be integrated with quantrs2 in future versions.
Sourcepub fn sample_state(
&self,
state: &SimulatedState,
num_samples: usize,
) -> Result<Vec<Vec<usize>>>
pub fn sample_state( &self, state: &SimulatedState, num_samples: usize, ) -> Result<Vec<Vec<usize>>>
Sample from a state.
Sourcepub fn state_to_factor(
&self,
state: &SimulatedState,
variable_names: &[String],
) -> Result<Factor>
pub fn state_to_factor( &self, state: &SimulatedState, variable_names: &[String], ) -> Result<Factor>
Convert simulation results to a PGM factor.
Creates a factor representing the probability distribution over the measured qubits.
Sourcepub fn quantum_sample(
&self,
graph: &FactorGraph,
num_shots: usize,
) -> Result<Vec<Assignment>>
pub fn quantum_sample( &self, graph: &FactorGraph, num_shots: usize, ) -> Result<Vec<Assignment>>
Sample from a factor graph using quantum-enhanced methods.
This is a placeholder for QAOA-based sampling.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for QuantumSimulationBackend
impl !RefUnwindSafe for QuantumSimulationBackend
impl Send for QuantumSimulationBackend
impl Sync for QuantumSimulationBackend
impl Unpin for QuantumSimulationBackend
impl !UnwindSafe for QuantumSimulationBackend
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.