Skip to main content

solve_linear

Function solve_linear 

Source
pub fn solve_linear<F, M>(
    a: &mut M,
    b: &[F],
    start: &[F],
    options: &Options<'_, F>,
) -> Result<Found<Vec<F>, F>, <M as Mapping<F>>::Error>
where F: Native, M: Mapping<F>,
Expand description

The solution of A x = b from start, by the method Options::method_for gives. a gives A’s products with vectors, and b has one item for each equation. A system that isn’t square, or whose a gives products with A’s transpose through Mapping::vjp, gets its least-squares solution, from the normal equations AᵀA x = Aᵀb. A right-hand side of zeros gives zeros. a’s Mapping::precondition gives the products of a preconditioner M, which approximates A⁻¹, or (AᵀA)⁻¹ for least squares. CG and MINRES need M symmetric positive definite, and GMRES applies it on the right. A good M cuts the products a solve needs.

§Panics

If Options::check rejects the options.