pub struct ApplyOptions {
pub method: ContractionMethod,
pub max_rank: Option<usize>,
pub svd_policy: Option<SvdTruncationPolicy>,
pub qr_rtol: Option<f64>,
pub nfullsweeps: usize,
pub convergence_tol: Option<f64>,
}Expand description
Options for apply_linear_operator.
Controls the contraction algorithm, truncation parameters, and iterative sweep settings.
§Defaults
method:ContractionMethod::Zipup(single-sweep, no iteration)max_rank:None(no rank limit)svd_policy:None(uses the SVD global default policy)qr_rtol:None(uses the QR global default tolerance)nfullsweeps:1(only used by Fit method)convergence_tol:None(only used by Fit method)
§Examples
use tensor4all_treetn::ApplyOptions;
use tensor4all_core::SvdTruncationPolicy;
// Default: Zipup with no truncation
let opts = ApplyOptions::default();
assert_eq!(opts.max_rank, None);
// Zipup with rank and tolerance limits
let opts = ApplyOptions::zipup()
.with_max_rank(50)
.with_svd_policy(SvdTruncationPolicy::new(1e-8));
assert_eq!(opts.max_rank, Some(50));
assert_eq!(opts.svd_policy, Some(SvdTruncationPolicy::new(1e-8)));
// Fit method with sweep control
let opts = ApplyOptions::fit().with_nfullsweeps(3).with_max_rank(20);
assert_eq!(opts.nfullsweeps, 3);
// Naive contraction (exact, no truncation)
let opts = ApplyOptions::naive();
assert_eq!(opts.max_rank, None);Fields§
§method: ContractionMethodContraction method to use.
max_rank: Option<usize>Maximum bond dimension for truncation.
svd_policy: Option<SvdTruncationPolicy>Explicit SVD truncation policy.
qr_rtol: Option<f64>QR-specific relative tolerance.
nfullsweeps: usizeNumber of full sweeps for Fit method.
A full sweep visits each edge twice (forward and backward) using an Euler tour.
convergence_tol: Option<f64>Convergence tolerance for Fit method.
Implementations§
Source§impl ApplyOptions
impl ApplyOptions
Sourcepub fn with_max_rank(self, max_rank: usize) -> Self
pub fn with_max_rank(self, max_rank: usize) -> Self
Set maximum bond dimension.
Sourcepub fn with_svd_policy(self, policy: SvdTruncationPolicy) -> Self
pub fn with_svd_policy(self, policy: SvdTruncationPolicy) -> Self
Set the SVD truncation policy.
Sourcepub fn with_qr_rtol(self, rtol: f64) -> Self
pub fn with_qr_rtol(self, rtol: f64) -> Self
Set the QR-specific truncation tolerance.
Sourcepub fn with_nfullsweeps(self, nfullsweeps: usize) -> Self
pub fn with_nfullsweeps(self, nfullsweeps: usize) -> Self
Set number of full sweeps for Fit method.
Trait Implementations§
Source§impl Clone for ApplyOptions
impl Clone for ApplyOptions
Source§fn clone(&self) -> ApplyOptions
fn clone(&self) -> ApplyOptions
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 Debug for ApplyOptions
impl Debug for ApplyOptions
Auto Trait Implementations§
impl Freeze for ApplyOptions
impl RefUnwindSafe for ApplyOptions
impl Send for ApplyOptions
impl Sync for ApplyOptions
impl Unpin for ApplyOptions
impl UnsafeUnpin for ApplyOptions
impl UnwindSafe for ApplyOptions
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