pub struct TensorNetworkSimulator { /* private fields */ }
Expand description
Tensor network simulator
Implementations§
Source§impl TensorNetworkSimulator
impl TensorNetworkSimulator
Sourcepub fn with_backend(self) -> Result<Self>
pub fn with_backend(self) -> Result<Self>
Initialize with SciRS2 backend
Sourcepub fn with_strategy(self, strategy: ContractionStrategy) -> Self
pub fn with_strategy(self, strategy: ContractionStrategy) -> Self
Set contraction strategy
Sourcepub fn with_max_bond_dim(self, max_bond_dim: usize) -> Self
pub fn with_max_bond_dim(self, max_bond_dim: usize) -> Self
Set maximum bond dimension
Sourcepub fn initialize_zero_state(&mut self) -> Result<()>
pub fn initialize_zero_state(&mut self) -> Result<()>
Initialize |0…0⟩ state
Sourcepub fn apply_gate(&mut self, gate: QuantumGate) -> Result<()>
pub fn apply_gate(&mut self, gate: QuantumGate) -> Result<()>
Apply quantum gate to the tensor network
Sourcepub fn measure(&mut self, qubit: usize) -> Result<bool>
pub fn measure(&mut self, qubit: usize) -> Result<bool>
Measure a qubit in the computational basis
Sourcepub fn get_probability_amplitude(&self, state: &[bool]) -> Result<Complex64>
pub fn get_probability_amplitude(&self, state: &[bool]) -> Result<Complex64>
Get probability amplitude for a computational basis state
Sourcepub fn get_state_vector(&self) -> Result<Array1<Complex64>>
pub fn get_state_vector(&self) -> Result<Array1<Complex64>>
Get all probability amplitudes
Sourcepub fn contract(&mut self) -> Result<Complex64>
pub fn contract(&mut self) -> Result<Complex64>
Contract the tensor network using the specified strategy
Sourcepub fn get_stats(&self) -> &TensorNetworkStats
pub fn get_stats(&self) -> &TensorNetworkStats
Get simulation statistics
Sourcepub fn contract_network_to_state_vector(&self) -> Result<Array1<Complex64>>
pub fn contract_network_to_state_vector(&self) -> Result<Array1<Complex64>>
Contract the tensor network to obtain the full quantum state vector
Sourcepub fn reset_stats(&mut self)
pub fn reset_stats(&mut self)
Reset statistics
Sourcepub fn estimate_contraction_cost(&self) -> u64
pub fn estimate_contraction_cost(&self) -> u64
Estimate contraction cost for current network
Trait Implementations§
Source§impl Debug for TensorNetworkSimulator
impl Debug for TensorNetworkSimulator
Source§impl Default for TensorNetworkSimulator
impl Default for TensorNetworkSimulator
Auto Trait Implementations§
impl Freeze for TensorNetworkSimulator
impl !RefUnwindSafe for TensorNetworkSimulator
impl Send for TensorNetworkSimulator
impl Sync for TensorNetworkSimulator
impl Unpin for TensorNetworkSimulator
impl !UnwindSafe for TensorNetworkSimulator
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.