Expand description
Sparse linear algebra: a compressed-sparse-row matrix and the conjugate gradient least-squares solver built on it.
The consumer this exists for is a constraint solver whose Jacobian has a row per residual and entries only under the parameters that residual names, a matrix that is nearly all zeros and whose dense factorization cost grows with the whole parameter vector rather than with the constraints. CGNR works entirely through products with the matrix and its transpose, so its cost per iteration is the number of stored entries.
Starting from zero, CGNR converges to the least-squares solution lying in the row space (the minimum-norm solution), which is the same answer a pseudo-inverse gives, so a caller can swap it for an SVD solve and expect agreement, not merely feasibility.
Structs§
- Sparse
Matrix - A read-only sparse matrix in compressed-sparse-row form.
Functions§
- least_
squares_ cgnr - Minimize
‖A·x − b‖by conjugate gradient on the normal equations, from zero, so a rank-deficient system yields the minimum-norm least-squares solution. Convergence is declared when the gradient‖Aᵀ(b − A·x)‖falls totolerancerelative to‖Aᵀb‖;Nonemeans the iteration budget ran out before that happened.