pub struct TruncateOptions { /* private fields */ }Expand description
Options for tensor train truncation.
Truncation is explicitly SVD-based. Canonicalization remains the API for LU/CI-style forms; truncate itself only accepts SVD truncation controls.
§Examples
use tensor4all_core::SvdTruncationPolicy;
use tensor4all_itensorlike::TruncateOptions;
let opts = TruncateOptions::svd()
.with_svd_policy(SvdTruncationPolicy::new(1e-10))
.with_max_rank(20)
.with_site_range(0..4);
assert_eq!(opts.svd_policy(), Some(SvdTruncationPolicy::new(1e-10)));
assert_eq!(opts.max_rank(), Some(20));
assert_eq!(opts.site_range(), Some(0..4));Implementations§
Source§impl TruncateOptions
impl TruncateOptions
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_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_site_range(self, range: Range<usize>) -> Self
pub fn with_site_range(self, range: Range<usize>) -> Self
Set the site range for truncation.
The range is 0-indexed with exclusive end.
Sourcepub fn svd_policy(&self) -> Option<SvdTruncationPolicy>
pub fn svd_policy(&self) -> Option<SvdTruncationPolicy>
Get the SVD truncation policy override.
Sourcepub fn site_range(&self) -> Option<Range<usize>>
pub fn site_range(&self) -> Option<Range<usize>>
Get the site range for truncation.
Trait Implementations§
Source§impl Clone for TruncateOptions
impl Clone for TruncateOptions
Source§fn clone(&self) -> TruncateOptions
fn clone(&self) -> TruncateOptions
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 TruncateOptions
impl Debug for TruncateOptions
Source§impl Default for TruncateOptions
impl Default for TruncateOptions
Source§fn default() -> TruncateOptions
fn default() -> TruncateOptions
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for TruncateOptions
impl RefUnwindSafe for TruncateOptions
impl Send for TruncateOptions
impl Sync for TruncateOptions
impl Unpin for TruncateOptions
impl UnsafeUnpin for TruncateOptions
impl UnwindSafe for TruncateOptions
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