Skip to content

Commit 0b35390

Browse files
committed
Fix nonlinear problem instantiation
1 parent 960d8e4 commit 0b35390

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/systems/nonlinear/nonlinearsystem.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ function DiffEqBase.NonlinearFunction{iip}(sys::NonlinearSystem, dvs = states(sy
175175

176176
NonlinearFunction{iip}(f,
177177
jac = _jac === nothing ? nothing : _jac,
178-
jac_prototype = sparse ? similar(sys.jac[],Float64) : nothing,
178+
jac_prototype = sparse ? similar(calculate_jacobian(sys, sparse=sparse),Float64) : nothing,
179179
syms = Symbol.(states(sys)), observed = observedfun)
180180
end
181181

test/nonlinearsystem.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,14 +124,14 @@ np = NonlinearProblem(ns, [0,0,0], [1,2,3], jac=true, sparse=true)
124124
function makesys(name)
125125
@parameters a
126126
@variables x f
127-
127+
128128
NonlinearSystem([0 ~ -a*x + f],[x,f],[a], name=name)
129129
end
130-
130+
131131
function issue819()
132132
sys1 = makesys(:sys1)
133133
sys2 = makesys(:sys1)
134134
@test_throws ArgumentError NonlinearSystem([sys2.f ~ sys1.x, sys1.f ~ 0],[],[], systems=[sys1, sys2])
135135
end
136136
issue819()
137-
end
137+
end

0 commit comments

Comments
 (0)