pub fn solve_single_entry_neumann(
matrix: &dyn Matrix,
b: &[Precision],
target: usize,
max_terms: usize,
tolerance: Precision,
) -> Result<Precision>Expand description
Compute x[i] = e_iᵀ A⁻¹ b to within tolerance using closure-restricted
Neumann iteration, without materialising the full solution vector.
§Parameters
matrix: a square, strictly diagonally dominant matrixA(with a non-zero diagonal at rowtarget).b: the right-hand side.b.len()must equalmatrix.rows().target: the row indexiwhose solution entry to compute.max_terms: maximum number of Neumann terms. Picks the depth of the row-graph closure; pick⌈log_{1/ρ}(‖b‖∞ / tolerance)⌉for a strict ε bound, whereρis the spectral radius ofD⁻¹O.tolerance: early-exit threshold on per-term contribution tox[i].
§Returns
Ok(x_i_estimate) — the truncated Neumann approximation to x[target].
§Errors
SolverError::IndexOutOfBoundsiftarget >= matrix.rows().SolverError::DimensionMismatchifb.len() != matrix.rows().SolverError::InvalidInputifA[target, target] == 0orAhas a zero diagonal at any reachable row (Neumann series diverges).
§Examples
let b = vec![1.0, 2.0, 3.0, 4.0];
// Compute only x[2], skipping x[0], x[1], x[3].
let x2 = solve_single_entry_neumann(a, &b, 2, /*max_terms=*/ 16, /*tol=*/ 1e-10).unwrap();