pydae.core.diagnostics

pydae.core.diagnostics.diagnose_dae_model(jac_flat, fg, Nx, Ny, x_names=None, y_names=None, sparse_backend=None, Ap=None, Ai=None, save_figure='jacobian_diagnostic.png')[source]

Perform a numerical health check on the DAE Jacobian and residuals.

Parameters:
  • jac_flat (ndarray) – Flat Jacobian array from the C solver. Dense: length N², Sparse: length NNZ.

  • fg (ndarray) – Residual vector [f; g], length N.

  • Nx (int) – Number of differential / algebraic variables.

  • Ny (int) – Number of differential / algebraic variables.

  • x_names (list of str, optional) – Human-readable variable names.

  • y_names (list of str, optional) – Human-readable variable names.

  • sparse_backend (str or None) – None for dense, or 'klu' / 'pardiso' / 'accelerate'.

  • Ap (array-like or None) – Sparsity structure arrays (required when sparse_backend is set).

  • Ai (array-like or None) – Sparsity structure arrays (required when sparse_backend is set).

  • save_figure (str or None) – Path to save the heatmap image. None to skip.

Modules

dae_check

Numerical diagnostic tool for DAE solver failures.