Skip to content

Commit

Permalink
Fix ODEFunction QuoteNode bug and implement iip_config (#1887)
Browse files Browse the repository at this point in the history
  • Loading branch information
bradcarman authored Oct 19, 2022
1 parent 8a03d0e commit 3ee1f87
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/systems/diffeqs/abstractodesystem.jl
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,7 @@ function ODEFunctionExpr{iip}(sys::AbstractODESystem, dvs = states(sys),
jac_prototype = $jp_expr,
syms = $(Symbol.(states(sys))),
indepsym = $(QuoteNode(Symbol(get_iv(sys)))),
paramsyms = $(QuoteNode(Symbol.(parameters(sys)))),
paramsyms = $(Symbol.(parameters(sys))),
sparsity = $(jacobian_sparsity(sys)))
end
!linenumbers ? striplines(ex) : ex
Expand Down
9 changes: 9 additions & 0 deletions test/odesystem.jl
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,15 @@ for f in [
@test J == f.jac(u, p, t)
end

#check iip_config
f = eval(ODEFunctionExpr(de, [x, y, z], [σ, ρ, β], iip_config = (false, true)))
du = zeros(3)
u = collect(1:3)
p = collect(4:6)
f.f(du, u, p, 0.1)
@test du == [4, 0, -16]
@test_throws ArgumentError f.f(u, p, 0.1)

eqs = [D(x) ~ σ * (y - x),
D(y) ~ x *- z) - y * t,
D(z) ~ x * y - β * z]
Expand Down

0 comments on commit 3ee1f87

Please sign in to comment.