Skip to content

Commit 9a3a0d6

Browse files
fixup! fixup! fix: make flatten_equations type-stable
1 parent 0a9ad57 commit 9a3a0d6

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/utils.jl

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1182,8 +1182,14 @@ without scalarizing occurrences of array variables and return the new list of eq
11821182
function flatten_equations(eqs::Vector{Equation})
11831183
_eqs = Equation[]
11841184
for eq in eqs
1185-
for (i1, i2) in zip(SU.stable_eachindex(eq.lhs), SU.stable_eachindex(eq.rhs))
1186-
push!(_eqs, eq.lhs[i1] ~ eq.rhs[i2])
1185+
if !SU.is_array_shape(SU.shape(eq.lhs))
1186+
push!(_eqs, eq)
1187+
continue
1188+
end
1189+
lhs = vec(collect(eq.lhs)::Array{SymbolicT})::Vector{SymbolicT}
1190+
rhs = vec(collect(eq.rhs)::Array{SymbolicT})::Vector{SymbolicT}
1191+
for (l, r) in zip(lhs, rhs)
1192+
push!(_eqs, l ~ r)
11871193
end
11881194
end
11891195
return _eqs

0 commit comments

Comments
 (0)