pub struct BiCgStabResult<T> {
pub solution: T,
pub iterations: usize,
pub residual_norm: f64,
pub converged: bool,
}Expand description
Solution and true-residual diagnostics returned by bicgstab.
Like super::CgResult, the residual is absolute; super::GmresResult
reports a relative residual by default.
§Examples
use tensor4all_core::{krylov::{bicgstab, BiCgStabOptions}, DynIndex, IdxTensor, TensorVectorSpace};
let i = DynIndex::new_dyn(2);
let b = IdxTensor::from_dense(vec![i.clone()], vec![2.0_f64, 4.0])?;
let x0 = IdxTensor::zeros::<f64>(vec![i])?;
let result = bicgstab(|x: &IdxTensor| Ok(x.scale(2.0.into())?), &b, &x0, &BiCgStabOptions::default())?;
assert!(result.converged);
assert_eq!(result.solution.to_vec::<f64>()?, vec![1.0, 2.0]);
assert_eq!(result.residual_norm, 0.0);Fields§
§solution: TApproximate solution, including the initial guess’s contribution.
iterations: usizeConsumed cycles, bounded by BiCgStabOptions::max_iter.
Convergence at the intermediate BiCG step counts as one cycle.
This counts cycles, not operator applications. A full cycle applies
the operator twice, and each true-residual check applies it once more.
super::GmresResult::iterations counts inner GMRES steps, one
operator application each, so compare the two by operator applications.
residual_norm: f64Absolute true residual norm ||b - A*x||, also on budget exhaustion.
converged: boolWhether the true residual met max(atol, rtol * ||b||).
Trait Implementations§
Source§impl<T: Clone> Clone for BiCgStabResult<T>
impl<T: Clone> Clone for BiCgStabResult<T>
Auto Trait Implementations§
impl<T> Freeze for BiCgStabResult<T>where
T: Freeze,
impl<T> RefUnwindSafe for BiCgStabResult<T>where
T: RefUnwindSafe,
impl<T> Send for BiCgStabResult<T>where
T: Send,
impl<T> Sync for BiCgStabResult<T>where
T: Sync,
impl<T> Unpin for BiCgStabResult<T>where
T: Unpin,
impl<T> UnsafeUnpin for BiCgStabResult<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for BiCgStabResult<T>where
T: UnwindSafe,
Blanket Implementations§
§impl<U> As for U
impl<U> As for U
§fn as_<T>(self) -> Twhere
T: CastFrom<U>,
U: Sized,
fn as_<T>(self) -> Twhere
T: CastFrom<U>,
U: Sized,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T, U> Imply<T> for U
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