@@ -153,6 +153,7 @@ function DiffEqBase.ODEFunction{iip}(sys::AbstractODESystem, dvs = states(sys),
153
153
jac = _jac === nothing ? nothing : DiffEqBase. EvalFunc (_jac),
154
154
tgrad = _tgrad === nothing ? nothing : DiffEqBase. EvalFunc (_tgrad),
155
155
mass_matrix = _M,
156
+ jac_prototype = sparse ? similar (sys. jac,Float64) : nothing ,
156
157
syms = Symbol .(states (sys)))
157
158
end
158
159
@@ -202,6 +203,8 @@ function ODEFunctionExpr{iip}(sys::AbstractODESystem, dvs = states(sys),
202
203
203
204
_M = (u0 === nothing || M == I) ? M : ArrayInterface. restructure (u0 .* u0' ,M)
204
205
206
+ jp_expr = sparse ? :(similar ($ (sys. jac),Float64)) : :nothing
207
+
205
208
ex = quote
206
209
f = $ f
207
210
tgrad = $ _tgrad
@@ -212,6 +215,7 @@ function ODEFunctionExpr{iip}(sys::AbstractODESystem, dvs = states(sys),
212
215
jac = jac,
213
216
tgrad = tgrad,
214
217
mass_matrix = M,
218
+ jac_prototype = $ jp_expr,
215
219
syms = $ (Symbol .(states (sys))))
216
220
end
217
221
! linenumbers ? striplines (ex) : ex
232
236
function DiffEqBase.ODEProblem{iip}(sys::AbstractODESystem,u0map,tspan,
233
237
parammap=DiffEqBase.NullParameters();
234
238
version = nothing, tgrad=false,
235
- jac = false,
239
+ jac = false,
236
240
checkbounds = false, sparse = false,
237
241
simplify = true,
238
242
linenumbers = true, parallel=SerialForm(),
0 commit comments