mario.set_linear_solver
- mario.set_linear_solver(solver: str)#
Set the default backend used by solve-based demand-driven formulas.
- Parameters:
solver – Linear solver backend name:
"scipy"(the default) or"umfpack". UMFPACK requires the optionalscikit-umfpackpackage and its native SuiteSparse libraries.
Notes
This setting only affects solve-based IOT/SUT formulas. It has no effect on the explicit-inverse path used to build the
w/wcc/waaLeontief inverse matrices directly.UMFPACK performs sparse direct LU solves with float64 precision and reuses factors within a resolution request. Set the linear strategy to
"direct"or"auto";"iterative"is incompatible with this backend. Numerical failures raise an error without a pseudo-inverse or least-squares fallback. Sparse indices use 64 bits to avoid the native int32 factor allocation limit. The solver compares fill-reducing orderings before factorization. Singular components are checked before factorization and reported with their node labels. By default they raise an error. An explicitmario.set_singular_policy()of"partial"can instead return independent coefficients with a warning and NaN at affected nodes. Results satisfy a relative residual threshold of1e-8, applied only to retained equations when a partial result is requested. Install withconda install -c conda-forge scikit-umfpack. With SuiteSparse already installed,pip install mariopy[umfpack]is also supported.Examples
>>> mario.set_compute_method("solve") >>> mario.set_linear_solver("umfpack") >>> mario.set_linear_strategy("direct")