Skip to main content

KPreconditioner

Trait KPreconditioner 

Source
pub trait KPreconditioner: Send {
    type Scalar: KrystScalar;

    // Required methods
    fn dims(&self) -> (usize, usize);
    fn apply_s(
        &self,
        side: PcSide,
        x: &[Self::Scalar],
        y: &mut [Self::Scalar],
        scratch: &mut BridgeScratch,
    ) -> Result<(), KError>;

    // Provided methods
    fn apply_op_s(
        &self,
        op: Op,
        x: &[Self::Scalar],
        y: &mut [Self::Scalar],
        scratch: &mut BridgeScratch,
    ) -> Result<(), KError> { ... }
    fn capabilities_s(&self) -> PcCaps { ... }
    fn apply_mut_s(
        &mut self,
        side: PcSide,
        x: &[Self::Scalar],
        y: &mut [Self::Scalar],
        scratch: &mut BridgeScratch,
    ) -> Result<(), KError> { ... }
    fn on_restart_s(
        &mut self,
        outer_iter: usize,
        residual_norm: <Self::Scalar as KrystScalar>::Real,
    ) -> Result<(), KError> { ... }
}
Expand description

Internal, scalar-generic preconditioner interface.

The trait is object safe so solvers can work with Arc<dyn KPreconditioner<Scalar = S> + Sync> when sharing a handle between threads, or with mutable references when per-thread access is sufficient.

Required Associated Types§

Required Methods§

Source

fn dims(&self) -> (usize, usize)

Dimensions of the preconditioner, typically (n, n).

Source

fn apply_s( &self, side: PcSide, x: &[Self::Scalar], y: &mut [Self::Scalar], scratch: &mut BridgeScratch, ) -> Result<(), KError>

Apply the preconditioner.

Provided Methods§

Source

fn apply_op_s( &self, op: Op, x: &[Self::Scalar], y: &mut [Self::Scalar], scratch: &mut BridgeScratch, ) -> Result<(), KError>

Apply a selected matrix operation through the preconditioner.

Source

fn capabilities_s(&self) -> PcCaps

Capabilities exposed by the wrapped preconditioner.

Source

fn apply_mut_s( &mut self, side: PcSide, x: &[Self::Scalar], y: &mut [Self::Scalar], scratch: &mut BridgeScratch, ) -> Result<(), KError>

Apply the preconditioner in a mutable/flexible mode.

By default this delegates to apply_s, preserving backwards compatibility for immutable preconditioners while allowing flexible algorithms (e.g., FGMRES) to request a mutable handle when available.

Source

fn on_restart_s( &mut self, outer_iter: usize, residual_norm: <Self::Scalar as KrystScalar>::Real, ) -> Result<(), KError>

Optional hook invoked at solver restarts.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl KPreconditioner for AMG

Available on crate features backend-faer and complex only.
Source§

impl KPreconditioner for Asm

Available on crate features backend-faer and complex only.
Source§

impl KPreconditioner for AsmAmg

Available on crate features backend-faer and complex only.
Source§

impl KPreconditioner for BlockJacobi

Available on crate features backend-faer and complex only.
Source§

impl KPreconditioner for ChebyshevPc

Available on crate features backend-faer and complex only.
Source§

impl KPreconditioner for FsaiCsr

Available on crate features backend-faer and complex only.
Source§

impl KPreconditioner for Ilu

Available on crate features backend-faer and complex only.
Source§

impl KPreconditioner for IluCsr

Available on crate features backend-faer and complex only.
Source§

impl KPreconditioner for Ilup

Available on crate features backend-faer and complex only.
Source§

impl KPreconditioner for Ilutp

Available on crate features backend-faer and complex only.
Source§

impl KPreconditioner for Jacobi

Available on crate feature complex only.
Source§

impl KPreconditioner for LegacyOpPreconditioner

Available on crate features complex and legacy-pc-bridge only.
Source§

impl KPreconditioner for LuPc

Available on crate features backend-faer and complex and dense-direct only.
Source§

impl KPreconditioner for OverlapIluPc

Available on crate features backend-faer and complex only.
Source§

impl KPreconditioner for PcChain

Available on crate feature complex only.
Source§

impl KPreconditioner for QrPc

Available on crate features backend-faer and complex and dense-direct only.
Source§

impl KPreconditioner for RowFilterPreconditioner

Available on crate features backend-faer and complex only.
Source§

impl KPreconditioner for SorPc

Available on crate features backend-faer and complex only.
Source§

impl KPreconditioner for SpaiCsr

Available on crate features backend-faer and complex only.
Source§

impl KPreconditioner for SuperLuDistPc

Available on crate features backend-faer and complex only.
Source§

impl<M> KPreconditioner for ApproxInv<M, Vec<f64>, f64>
where M: MatVec<Vec<f64>> + Send + Sync + 'static,

Available on crate features backend-faer and complex only.
Source§

impl<PB> KPreconditioner for DeflationPC<PB>
where PB: Preconditioner,

Available on crate features backend-faer and complex only.