Skip to main content

solve_dense

Function solve_dense 

Source
pub fn solve_dense(a: Vec<Vec<f64>>, b: Vec<f64>) -> Option<Vec<f64>>
Expand description

Solves a small dense A x = b by Gaussian elimination with partial pivoting. Returns None if A is singular — no pivot clears a small absolute threshold.

Deliberately dense and deliberately unsophisticated: both callers pass a matrix whose order is a handful, where a sparse factorization’s setup would cost more than the whole solve. dc::solve_dc_network uses it for the HVDC Newton step, and linear::sensitivity for the k × k generalized-LODF system over an outage set of k branches. It lives here rather than in either of those because it is a numeric utility with no power-system content, and because a reader looking for the crate’s linear algebra looks here.

The absolute pivot threshold is meaningful for both callers: their matrices are O(1)-scaled (a Jacobian in per-unit, and I - Ψ whose entries are transfer fractions), so “no pivot above 1e-12” really does mean structurally singular rather than merely badly scaled.