Skip to content

Commit

Permalink
fix: HACK: handle incorrect result from linear_expansion when using…
Browse files Browse the repository at this point in the history
… symbolic arrays
  • Loading branch information
AayushSabharwal committed Jan 20, 2025
1 parent 15a467e commit 6cf8d98
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/structural_transformation/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -218,11 +218,18 @@ function find_eq_solvables!(state::TearingState, ieq, to_rm = Int[], coeffs = no
all_int_vars = true
coeffs === nothing || empty!(coeffs)
empty!(to_rm)

vars_buffer = Set()
for j in 𝑠neighbors(graph, ieq)
var = fullvars[j]
isirreducible(var) && (all_int_vars = false; continue)
a, b, islinear = linear_expansion(term, var)
a, b = unwrap(a), unwrap(b)
vars!(vars_buffer, b)
if islinear && isequal(a, 0) && var in vars_buffer
islinear = false
end
empty!(vars_buffer)
islinear || (all_int_vars = false; continue)
a = ModelingToolkit.fold_constants(a)
b = ModelingToolkit.fold_constants(b)
Expand Down

0 comments on commit 6cf8d98

Please sign in to comment.