pub struct LinsolveOptions { /* private fields */ }Expand description
Options for the linear solver.
Solves (a₀ + a₁ * A) * x = b using DMRG-like sweeps with local GMRES.
§Examples
use tensor4all_core::SvdTruncationPolicy;
use tensor4all_itensorlike::LinsolveOptions;
let opts = LinsolveOptions::new(5)
.with_svd_policy(SvdTruncationPolicy::new(1e-10))
.with_max_rank(64)
.with_krylov_tol(1e-8)
.with_coefficients(1.0, -1.0);
assert_eq!(opts.max_rank(), Some(64));
assert_eq!(opts.svd_policy(), Some(SvdTruncationPolicy::new(1e-10)));
assert_eq!(opts.nhalfsweeps(), 10);Implementations§
Source§impl LinsolveOptions
impl LinsolveOptions
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_nhalfsweeps(self, nhalfsweeps: usize) -> Self
pub fn with_nhalfsweeps(self, nhalfsweeps: usize) -> Self
Set number of half-sweeps.
Sourcepub fn with_nsweeps(self, nsweeps: usize) -> Self
pub fn with_nsweeps(self, nsweeps: usize) -> Self
Set number of full sweeps.
Sourcepub fn with_krylov_tol(self, tol: f64) -> Self
pub fn with_krylov_tol(self, tol: f64) -> Self
Set GMRES tolerance.
Sourcepub fn with_krylov_maxiter(self, maxiter: usize) -> Self
pub fn with_krylov_maxiter(self, maxiter: usize) -> Self
Set maximum GMRES iterations per local solve.
Sourcepub fn with_krylov_dim(self, dim: usize) -> Self
pub fn with_krylov_dim(self, dim: usize) -> Self
Set Krylov subspace dimension (restart parameter).
Sourcepub fn with_coefficients(self, a0: f64, a1: f64) -> Self
pub fn with_coefficients(self, a0: f64, a1: f64) -> Self
Set coefficients a₀ and a₁ in (a₀ + a₁ * A) * x = b.
Sourcepub fn with_convergence_tol(self, tol: f64) -> Self
pub fn with_convergence_tol(self, tol: f64) -> Self
Set convergence tolerance for early termination.
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.
Sourcepub fn krylov_tol(&self) -> f64
pub fn krylov_tol(&self) -> f64
Get GMRES tolerance.
Sourcepub fn krylov_maxiter(&self) -> usize
pub fn krylov_maxiter(&self) -> usize
Get maximum GMRES iterations per local solve.
Sourcepub fn krylov_dim(&self) -> usize
pub fn krylov_dim(&self) -> usize
Get Krylov subspace dimension.
Sourcepub fn coefficients(&self) -> (f64, f64)
pub fn coefficients(&self) -> (f64, f64)
Get coefficients (a0, a1).
Sourcepub fn convergence_tol(&self) -> Option<f64>
pub fn convergence_tol(&self) -> Option<f64>
Get convergence tolerance.
Trait Implementations§
Source§impl Clone for LinsolveOptions
impl Clone for LinsolveOptions
Source§fn clone(&self) -> LinsolveOptions
fn clone(&self) -> LinsolveOptions
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 LinsolveOptions
impl Debug for LinsolveOptions
Auto Trait Implementations§
impl Freeze for LinsolveOptions
impl RefUnwindSafe for LinsolveOptions
impl Send for LinsolveOptions
impl Sync for LinsolveOptions
impl Unpin for LinsolveOptions
impl UnsafeUnpin for LinsolveOptions
impl UnwindSafe for LinsolveOptions
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