Skip to main content

Preconditioner

Enum Preconditioner 

Source
pub enum Preconditioner {
    Identity,
    Jacobi(JacobiPreconditioner),
    Ilu0(Ilu0Preconditioner),
}
Expand description

Preconditioner M^{-1} ≈ A^{-1}, dispatched by enum (no trait objects).

A preconditioner turns a residual r into z = M^{-1} r, an approximate error, which the Krylov solvers use to accelerate convergence. Construct one from the system matrix with Preconditioner::jacobi or Preconditioner::ilu0, or use Preconditioner::identity for none.

Variants§

§

Identity

No preconditioning: M = I, so z = r.

§

Jacobi(JacobiPreconditioner)

Diagonal (Jacobi) scaling: z = r / diag(A).

§

Ilu0(Ilu0Preconditioner)

ILU(0) incomplete factorisation: z = (LU)^{-1} r.

Implementations§

Source§

impl Preconditioner

Source

pub fn identity() -> Self

Identity preconditioner (M = I) — equivalent to no preconditioning.

Source

pub fn jacobi(a: &LduMatrix) -> Self

Build a Jacobi (reciprocal-diagonal) preconditioner from a.

Cannot break down: a zero diagonal entry is treated as 1.0. The guaranteed-robust choice when ILU(0) is not warranted.

Source

pub fn ilu0(a: &LduMatrix) -> Self

Build an ILU(0) preconditioner from a (same sparsity pattern as A).

A genuine incomplete LU factorisation with a small-pivot guard; see Ilu0Preconditioner. Typically far stronger than Jacobi on diagonally-dominant / mildly ill-conditioned systems.

Source

pub fn apply(&self, r: &[f64], z: &mut [f64])

Apply the preconditioner: write z = M^{-1} r.

r and z must both have length n_cells. For Preconditioner::Identity this copies r into z.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.