Expand description
Event-gated incremental solve — ADR-001 roadmap item #2.
The central architectural lift in this crate. Instead of paying
O(k · nnz(A)) cold-start cost per call when a downstream system
delivers a sparse update to the right-hand side, callers get to
warm-start the iterative solver from the previous solution and pay
O(k_warm · nnz(A)) where k_warm ≪ k_cold for small deltas. On
diagonally-dominant systems the inner solve over the delta has rapid
spatial decay, so k_warm is often a small constant.
§Why it matters in the stack
Every always-on system in the ADR’s directive — Cognitum reflex loops,
RuView change detection, Ruflo’s agentic inner loops, ruvector graph
repair — receives input as a stream of small deltas, not as fresh
full RHS vectors. Without this entry point each tick pays full
O(nnz(A)) even when 99% of b is unchanged. With it, steady-state
cost falls toward the sparsity of the delta itself.
§API
let solver = NeumannSolver::new(64, 1e-10);
// 2 entries of b changed:
let delta = SparseDelta::new(vec![3, 17], vec![0.5, -0.2])?;
let result = solver.solve_on_change(
matrix as &dyn Matrix,
&prev_solution,
&delta,
&SolverOptions::default(),
)?;§Complexity
The IncrementalSolver blanket impl on any SolverAlgorithm:
- Cold-start equivalent fallback: when
nnz(delta) > break_even, falls back to a full solve. Configurable viaIncrementalConfig::full_solve_break_even. - Warm-start path: when delta is sparse, runs
solve()withinitial_guess = prev_solution. Iteration count drops in proportion to the L₂ norm of the residualb_new − A·prev_solution, which is||A · z||for the delta-induced correctionz = A⁻¹ · delta. - On well-conditioned DD systems with
||delta|| / ||b|| ≈ ε, this typically converges inO(log(1/ε))warm-start iters instead ofO(√κ · log(1/ε))cold.
Structs§
- Incremental
Config - Configuration for the incremental solve. Mostly: when to give up on warm-start and just do a full solve.
- Incremental
Solve Op - Marker type with a
Complexityimpl declaring the asymptotic class ofIncrementalSolver::solve_on_change. Pure documentation — the actual impl lives on the underlying solver’sComplexityimpl, this just exists so MCP schema generation has a stable target. - Solve
OnChange Sublinear Op - Op marker for
solve_on_change_sublinear. SubLinear innend-to-end. - Sparse
Delta - A sparse update to a right-hand side vector.
indices[i]names the row whose value inbchanged byvalues[i](additive — pass the delta, not the new absolute value).
Traits§
- Incremental
Solver - Extension trait that adds an event-gated entry point to any
SolverAlgorithm. Blanket-implemented below, so every solver in the crate getssolve_on_changefor free.
Functions§
- solve_
on_ change_ sublinear - SubLinear sibling of
IncrementalSolver::solve_on_change. ReturnsVec<(usize, Precision)>of(row_index, x_new[row])for every row in the bounded-depth closure ofdelta’s support, computed without touching any row outside the closure. - solve_
on_ change_ sublinear_ auto - Magic-number-free sibling of
solve_on_change_sublinear. Takes only(matrix, prev, b_new, delta, tolerance)and auto-tunes bothclosure_depthandmax_termsfrom the matrix’s coherence margin viacrate::coherence::optimal_neumann_terms. - solve_
on_ change_ sublinear_ auto_ with_ rho - Tightest-bound variant of
solve_on_change_sublinear_auto: takes a caller-supplied spectral-radiusrho(e.g. fromcrate::coherence::approximate_spectral_radius) and uses it to pickmax_termsviacrate::coherence::optimal_neumann_terms_with_rhoinstead of the loose(1 - coherence)bound.