#[repr(i32)]pub enum ContractionAlgorithm {
Naive = 0,
ZipUp = 1,
Fit = 2,
}Expand description
Algorithm for tensor train contraction (TT-TT or MPO-MPO).
These algorithms contract two tensor trains and produce a new tensor train, optionally with compression/truncation.
§C API Representation
T4A_CONTRACT_NAIVE= 0T4A_CONTRACT_ZIPUP= 1T4A_CONTRACT_FIT= 2
Variants§
Naive = 0
Naive contraction followed by compression.
Contracts all site tensors first (producing large intermediate tensors), then compresses the result. Exact up to compression tolerance.
Memory: O(D^4) where D is the bond dimension.
ZipUp = 1
Zip-up contraction with on-the-fly compression.
Contracts and compresses site-by-site, keeping bond dimensions small. More memory efficient than naive, but may introduce additional error.
Memory: O(D^2)
Fit = 2
Variational fitting algorithm.
Optimizes the result tensor train to minimize the distance to the exact contraction. Uses sweeping optimization.
Best for cases where target bond dimension is much smaller than the exact result.
Implementations§
Trait Implementations§
Source§impl Clone for ContractionAlgorithm
impl Clone for ContractionAlgorithm
Source§fn clone(&self) -> ContractionAlgorithm
fn clone(&self) -> ContractionAlgorithm
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ContractionAlgorithm
impl Debug for ContractionAlgorithm
Source§impl Default for ContractionAlgorithm
impl Default for ContractionAlgorithm
Source§fn default() -> ContractionAlgorithm
fn default() -> ContractionAlgorithm
Source§impl Hash for ContractionAlgorithm
impl Hash for ContractionAlgorithm
Source§impl PartialEq for ContractionAlgorithm
impl PartialEq for ContractionAlgorithm
impl Copy for ContractionAlgorithm
impl Eq for ContractionAlgorithm
impl StructuralPartialEq for ContractionAlgorithm
Auto Trait Implementations§
impl Freeze for ContractionAlgorithm
impl RefUnwindSafe for ContractionAlgorithm
impl Send for ContractionAlgorithm
impl Sync for ContractionAlgorithm
impl Unpin for ContractionAlgorithm
impl UnsafeUnpin for ContractionAlgorithm
impl UnwindSafe for ContractionAlgorithm
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>,
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
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>,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.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>
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>
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