Skip to main content

sparse_backward_error

Function sparse_backward_error 

Source
pub fn sparse_backward_error(
    a: &SparseColMat<usize, f64>,
    x: &Col<f64>,
    b: &Col<f64>,
) -> f64
Expand description

Compute backward error using sparse matrix-vector multiply.

Returns ||Ax - b|| / (||A||_F * ||x|| + ||b||). Uses direct sparse iteration to avoid O(n^2) dense conversion.

Matrix storage: Expects a full symmetric CSC matrix (both triangles stored), which is what our .mtx reader and SparseColMat::try_new_from_triplets produce. Each off-diagonal entry (i,j) appears in both column i and column j.

The Frobenius norm and matrix-vector product are computed directly from the stored entries. This is O(nnz) work and O(n) extra memory.