Function invert_dense_matrix
pub fn invert_dense_matrix<T>(
matrix: &[Vec<T>],
pivot: DensePivot,
singular_pivot: f64,
relative_pivot: f64,
) -> Option<Vec<Vec<T>>>where
T: DenseScalar,Expand description
The inverse of a small dense square matrix by Gauss-Jordan elimination
in the pivot order (DensePivot). None when a pivot’s magnitude is
NaN, infinite (under DensePivot::Partial; under
DensePivot::OpenDssDiagonal an infinite unscaled magnitude is a
pivot), singular_pivot or smaller, or relative_pivot times
the largest original magnitude in its column or smaller. Each caller
states the pivot its quantity is singular at: an absolute
singular_pivot (ohms for a series impedance, a dimensionless
coefficient for a potential matrix) and a relative_pivot that measures
cancellation within a column against that column’s own scale (the dense
PTDF fallback passes n ε, so a column eliminated to rounding noise is
singular while a wide but valid spread of magnitudes stays invertible).
Zero for both refuses only exact singularity. A one by one matrix
inverts as its scaled reciprocal (DenseScalar::reciprocal). An empty
matrix inverts to an empty matrix.
The one dense inverse: line and switch series admittances, the open line
Schur complement, overhead line potential coefficients (OpenDSS and
GridLAB-D geometry), the PMD transformer leakage round trip, Kron
reduction (powerio_dist::kron::calc_kron_reduced_impedance), the
transformer winding admittance and the dense PTDF fallback of
powerio-matrix read it with DensePivot::Partial, as does the
transmission bus merge’s zero impedance link flow recovery
(powerio-tx, an absolute floor of 1e-13 times the largest entry);
the OpenDSS source and line primitive check reads it with
DensePivot::OpenDssDiagonal.