Skip to main content

solve_complex

Function solve_complex 

Source
pub fn solve_complex(
    n: usize,
    entries: &[(usize, usize, Complex<f64>)],
    rhs: &[Complex<f64>],
) -> Option<Vec<Complex<f64>>>
Expand description

Solves a one-shot general complex sparse linear system A x = b. Returns None if the matrix is singular. Used by linear_initial_guess, which only solves once per power-flow run.

Unlike nalgebra’s dense LU, faer’s sparse LU does not detect singularity itself — it silently returns NaN-poisoned values instead of an error, so singularity is detected here via an explicit finiteness check on the result, to preserve the None-on-singular contract callers rely on.