pub struct ContractOptions { /* private fields */ }Expand description
Options for tensor train contraction.
§Examples
use tensor4all_core::SvdTruncationPolicy;
use tensor4all_itensorlike::ContractOptions;
let opts = ContractOptions::fit()
.with_svd_policy(SvdTruncationPolicy::new(1e-8))
.with_max_rank(50)
.with_nsweeps(3);
assert_eq!(opts.max_rank(), Some(50));
assert_eq!(opts.svd_policy(), Some(SvdTruncationPolicy::new(1e-8)));
assert_eq!(opts.nhalfsweeps(), 6);Implementations§
Source§impl ContractOptions
impl ContractOptions
Sourcepub fn with_max_rank(self, max_rank: usize) -> Self
pub fn with_max_rank(self, max_rank: usize) -> Self
Set the maximum retained bond dimension.
Sourcepub fn with_svd_policy(self, policy: SvdTruncationPolicy) -> Self
pub fn with_svd_policy(self, policy: SvdTruncationPolicy) -> Self
Set the explicit SVD truncation policy.
Sourcepub fn with_nhalfsweeps(self, nhalfsweeps: usize) -> Self
pub fn with_nhalfsweeps(self, nhalfsweeps: usize) -> Self
Set number of half-sweeps for fit contraction.
Sourcepub fn with_nsweeps(self, nsweeps: usize) -> Self
pub fn with_nsweeps(self, nsweeps: usize) -> Self
Set number of full sweeps.
A full sweep is two half-sweeps.
Sourcepub fn method(&self) -> ContractMethod
pub fn method(&self) -> ContractMethod
Get the contraction method.
Sourcepub fn svd_policy(&self) -> Option<SvdTruncationPolicy>
pub fn svd_policy(&self) -> Option<SvdTruncationPolicy>
Get the SVD truncation policy override.
Sourcepub fn nhalfsweeps(&self) -> usize
pub fn nhalfsweeps(&self) -> usize
Get number of half-sweeps.
Trait Implementations§
Source§impl Clone for ContractOptions
impl Clone for ContractOptions
Source§fn clone(&self) -> ContractOptions
fn clone(&self) -> ContractOptions
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 ContractOptions
impl Debug for ContractOptions
Auto Trait Implementations§
impl Freeze for ContractOptions
impl RefUnwindSafe for ContractOptions
impl Send for ContractOptions
impl Sync for ContractOptions
impl Unpin for ContractOptions
impl UnsafeUnpin for ContractOptions
impl UnwindSafe for ContractOptions
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