pub struct EnvironmentCache<T, V>{ /* private fields */ }Expand description
Simple environment cache for tensor network computations.
This struct handles:
- Storing computed environment tensors
- Cache invalidation when tensors are updated
The actual contraction logic is implemented in ProjectedOperator/ProjectedState.
Implementations§
Source§impl<T, V> EnvironmentCache<T, V>
impl<T, V> EnvironmentCache<T, V>
Sourcepub fn get(&self, from: &V, to: &V) -> Option<&T>
pub fn get(&self, from: &V, to: &V) -> Option<&T>
Get a cached environment tensor if it exists.
Sourcepub fn contains(&self, from: &V, to: &V) -> bool
pub fn contains(&self, from: &V, to: &V) -> bool
Check if environment exists for edge (from, to).
Sourcepub fn invalidate<'a, NT: NetworkTopology<V>>(
&mut self,
region: impl IntoIterator<Item = &'a V>,
topology: &NT,
)where
V: 'a,
pub fn invalidate<'a, NT: NetworkTopology<V>>(
&mut self,
region: impl IntoIterator<Item = &'a V>,
topology: &NT,
)where
V: 'a,
Invalidate all caches affected by updates to tensors in region.
For each t ∈ region:
- Remove all
env[(t, *)](0th generation) - Recursively remove caches propagating towards leaves
Trait Implementations§
Source§impl<T, V> Clone for EnvironmentCache<T, V>
impl<T, V> Clone for EnvironmentCache<T, V>
Source§fn clone(&self) -> EnvironmentCache<T, V>
fn clone(&self) -> EnvironmentCache<T, V>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<T, V> Debug for EnvironmentCache<T, V>
impl<T, V> Debug for EnvironmentCache<T, V>
Auto Trait Implementations§
impl<T, V> Freeze for EnvironmentCache<T, V>
impl<T, V> RefUnwindSafe for EnvironmentCache<T, V>where
T: RefUnwindSafe,
V: RefUnwindSafe,
impl<T, V> Send for EnvironmentCache<T, V>where
V: Send,
impl<T, V> Sync for EnvironmentCache<T, V>where
V: Sync,
impl<T, V> Unpin for EnvironmentCache<T, V>
impl<T, V> UnsafeUnpin for EnvironmentCache<T, V>
impl<T, V> UnwindSafe for EnvironmentCache<T, V>where
T: UnwindSafe,
V: UnwindSafe,
Blanket Implementations§
§impl<U> As for U
impl<U> As for U
§fn as_<T>(self) -> Twhere
T: CastFrom<U>,
fn as_<T>(self) -> Twhere
T: CastFrom<U>,
Casts
self to type T. The semantics of numeric casting with the as operator are followed, so <T as As>::as_::<U> can be used in the same way as T as U for numeric conversions. Read moreSource§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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T> DistributionExt for Twhere
T: ?Sized,
fn rand<T>(&self, rng: &mut (impl Rng + ?Sized)) -> Twhere
Self: Distribution<T>,
§impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T> DistributionExt for Twhere
T: ?Sized,
fn rand<T>(&self, rng: &mut (impl Rng + ?Sized)) -> Twhere
Self: Distribution<T>,
§impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T> DistributionExt for Twhere
T: ?Sized,
fn rand<T>(&self, rng: &mut (impl Rng + ?Sized)) -> Twhere
Self: Distribution<T>,
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 more