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
impl Preconditioner
Sourcepub fn jacobi(a: &LduMatrix) -> Self
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.
Sourcepub fn ilu0(a: &LduMatrix) -> Self
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.
Sourcepub fn apply(&self, r: &[f64], z: &mut [f64])
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.