Skip to content

Commit eb2172d

Browse files
simpler ODEFunction jacobian interface
1 parent ee80d95 commit eb2172d

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
@@ -215,10 +215,11 @@ Create an `ODEFunction` from the [`ODESystem`](@ref). The arguments `dvs` and `p
215215
are used to set the order of the dependent variable and parameter vectors,
216216
respectively.
217217
"""
218-
function DiffEqBase.ODEFunction(sys::ODESystem, dvs, ps; version::FunctionVersion = ArrayFunction)
218+
function DiffEqBase.ODEFunction(sys::ODESystem, dvs, ps; version::FunctionVersion = ArrayFunction,
219+
jac = false, Wfact = false)
219220
expr = eval(generate_function(sys, dvs, ps; version = version))
220-
jac_expr = isempty(sys.jac[]) ? nothing : eval(generate_jacobian(sys))
221-
Wfact_expr,Wfact_t_expr = isempty(sys.Wfact[]) ? (nothing,nothing) : eval.(calculate_factorized_W(sys))
221+
jac_expr = jac ? nothing : eval(generate_jacobian(sys))
222+
Wfact_expr,Wfact_t_expr = Wfact ? (nothing,nothing) : eval.(calculate_factorized_W(sys))
222223
if version === ArrayFunction
223224
ODEFunction{true}(eval(expr),jac=jac_expr,
224225
Wfact = Wfact_expr, Wfact_t = Wfact_t_expr)

0 commit comments

Comments
 (0)