Skip to main content

solve_affine

Function solve_affine 

Source
pub fn solve_affine<F, M>(
    f: &mut M,
    start: &[F],
    first: &[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 f(x) = 0 for an affine f, f(x) = A x − b, from start, by solve_linear on products that it computes from f’s values alone. first holds f(start), which the caller computes. It gives the number of residuals, and serves as f(0) where start is zero. f(0) gives −b. Each product A v is (f(t v) − f(0)) ÷ t, for the power of two t that makes t |A v| about 16 |b|. The subtraction of f(0) then loses no digits, however large b is. f’s vjp gives the transpose’s products, and its precondition the preconditioner’s. A product evaluates f once, or twice where the ratio |A v| ÷ |v| from the last product gave too small a t. evaluations counts products, as for solve_linear.

§Panics

If Options::check rejects the options.