Skip to content

Commit 2c55750

Browse files
handle non nlls
1 parent a3ea11c commit 2c55750

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/systems/nonlinear/modelingtoolkitize.jl

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,14 @@ function modelingtoolkitize(
4141
if prob isa NonlinearLeastSquaresProblem
4242
rhs = ArrayInterface.restructure(
4343
prob.f.resid_prototype, similar(prob.f.resid_prototype, Num))
44+
prob.f(rhs, vars, params)
45+
eqs = vcat([0.0 ~ rhs[i] for i in 1:length(prob.f.resid_prototype)]...)
4446
else
4547
rhs = ArrayInterface.restructure(prob.u0, similar(vars, Num))
48+
prob.f(rhs, vars, params)
49+
eqs = vcat([0.0 ~ rhs[i] for i in 1:length(rhs)]...)
4650
end
47-
prob.f(rhs, vars, params)
48-
eqs = vcat([0.0 ~ rhs[i] for i in 1:length(prob.f.resid_prototype)]...)
51+
4952
else
5053
rhs = prob.f(vars, params)
5154
out_def = prob.f(prob.u0, prob.p)

0 commit comments

Comments
 (0)