Skip to content

Commit 3ac7eb4

Browse files
Include Jacobian in generated ODEFunction
1 parent aabee57 commit 3ac7eb4

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/systems/diffeqs/diffeqsystem.jl

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -196,10 +196,11 @@ are used to set the order of the dependent variable and parameter vectors,
196196
respectively.
197197
"""
198198
function DiffEqBase.ODEFunction(sys::ODESystem, dvs, ps; version::FunctionVersion = ArrayFunction)
199-
expr = generate_function(sys, dvs, ps; version = version)
199+
expr = eval(generate_function(sys, dvs, ps; version = version))
200+
jac_expr = isempty(sys.jac[]) ? nothing : eval(sys.jac[])
200201
if version === ArrayFunction
201-
ODEFunction{true}(eval(expr))
202+
ODEFunction{true}(eval(expr),jac=jac_expr)
202203
elseif version === SArrayFunction
203-
ODEFunction{false}(eval(expr))
204+
ODEFunction{false}(eval(expr),jac=jac_expr)
204205
end
205206
end

0 commit comments

Comments
 (0)