Skip to main content

gmres_affine

Function gmres_affine 

Source
pub fn gmres_affine<T, F>(
    apply_a: F,
    b: &T,
    x0: &T,
    a0: AnyScalar,
    a1: AnyScalar,
    options: &GmresOptions,
) -> Result<GmresResult<T>, KrylovError>
where T: TensorVectorSpace, F: Fn(&T) -> Result<T>,
Expand description

Solve (a0 I + a1 A) x = b using GMRES with relative residual tolerance. The Arnoldi basis is built from the unshifted A callback, while affine coefficients are applied in the projected Hessenberg problem, matching KrylovKit’s affine linear-solve convention.

§Errors

Returns an error when the operator and vectors have incompatible shapes (a shape mismatch), when the affine coefficients are all zero (a KrylovError::NoAffineCoefficient for affine solves), or when an underlying tensor or backend operation fails (a KrylovError::Operation). Non-convergence is reported through the result’s converged flag and does not produce an error.