Skip to content

fix: fix incorrect differential variable handling in inline linear SCCs - #115

Merged
AayushSabharwal merged 3 commits into
mainfrom
as/fix-inline-scc
Jun 22, 2026
Merged

AayushSabharwal merged 3 commits into
mainfrom
as/fix-inline-scc

Conversation

@AayushSabharwal

Copy link
Copy Markdown
Contributor

Previously, we'd fixpoint_sub the total_sub mapping into equations in get_linear_scc_linsol. This is to properly handle the case when D(x) and x_t are in the same SCC. Deferring the substitution does not work. However, if total_sub contained D(x) ~ -y, then D(D(x)) would be substituted to D(-y), which is wrong and leads to incorrect codegen in specific models. This uses a variant of DerivativeDict which calls expand_derivatives, and reuses the codegen_equation! logic for handling differential equations. It also properly updates incidence of variables solved from an inline \.

Close #102

@AayushSabharwal
AayushSabharwal merged commit fc6bc03 into main Jun 22, 2026
8 of 9 checks passed
@AayushSabharwal
AayushSabharwal deleted the as/fix-inline-scc branch June 22, 2026 14:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

dummy_derivative_graph!: Jacobian columns not permuted after priority sort — vars[col_order[i]] indexes mismatched orders

1 participant