mtl5.sparse.klu#

mtl5.sparse.klu(A, threshold: float = 1.0, scale: bool = True, pivot_perturb: float = 0.0, accumulator: str | None = None)#

Factor a square sparse matrix with native KLU.

Permutes to block triangular form (Dulmage-Mendelsohn), orders each diagonal block with AMD, and LU-factorizes the blocks. Built for circuit matrices, which are highly reducible — check .nblocks to see how much structure was found.

scale=True factors R*A with row equilibration for pivot stability, which matters most in low precision; the RHS is scaled inside .solve().

The returned object exposes .solve(b) and .refactor(A2).

accumulator= types the dense numeric workspace, so a float32 factor can accumulate its updates in float64 (“f64”) or with an FMA (“fma32”/”fma64”). The factor itself stays in the element type — only the arithmetic that produced it widens. This is the mixed-precision knob a fixed-precision library cannot offer; see mtl5.sparse module docs for the measurement.