Skip to main content

verify_sparse_solution

Function verify_sparse_solution 

Source
pub fn verify_sparse_solution(
    matrix: &dyn Matrix,
    prev_solution: &[Precision],
    b: &[Precision],
    entries: &[(usize, Precision)],
    tolerance: Precision,
) -> Result<WitnessReport>
Expand description

Verify a sparse solution returned by one of the SubLinear orchestrators against the matrix + RHS.

entries is the Vec<(usize, Precision)> returned by crate::solve_on_change_sublinear (or crate::contrastive::contrastive_solve_on_change_sublinear — extract its candidate entries first). Entries outside the closure are assumed to be unchanged and pulled from prev_solution.

§Errors

§Returns

A WitnessReport with the worst residual + the pass/fail flag. Callers should treat report.ok == false as a hard solver bug on a strict-DD input.

§Examples

let report = verify_sparse_solution(a, prev, b_new, &entries, 1e-6).unwrap();
assert!(report.ok, "sparse-Neumann witness failed at row {:?}",
        report.worst_row);