pub fn coherence_score(matrix: &dyn Matrix) -> PrecisionExpand description
Compute the diagonal-dominance margin of a sparse matrix.
For each row i, computes |diag[i]| - Σ_{j≠i} |A[i,j]| (the
“diagonal-dominance excess”) and divides by |diag[i]| to get a
dimensionless score. The matrix’s coherence is the minimum of these
per-row scores: the worst row dominates the bound.
Returns a value in [-∞, 1]:
1.0— perfectly diagonal (every off-diagonal is zero).(0, 1)— strictly diagonally dominant; the larger the value, the more coherent. Neumann series convergence is guaranteed iff > 0.0.0— exactly on the diagonal-dominance boundary.- negative — not diagonally dominant; iterative solvers may diverge.
Cost: one pass through the matrix’s row iterator. O(nnz(A)) —
matches Linear complexity class per
ADR-001.