Skip to content

Commit 0c45be0

Browse files
committed
don't do sparse stuff on array
1 parent 9b1043e commit 0c45be0

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

lib/OrdinaryDiffEqDifferentiation/src/derivative_utils.jl

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,9 @@ function calc_J!(J, integrator, cache, next_step::Bool = false)
177177

178178
# we need to set all nzval to a non-zero number
179179
# otherwise in the following line any zero gets interpreted as a structural zero
180-
if !isnothing(integrator.f.jac_prototype)
180+
if !isnothing(integrator.f.jac_prototype) &&
181+
integrator.f.jac_prototype isa SparseMatrixCSC
182+
181183
integrator.f.jac_prototype.nzval .= 1.0
182184
J .= 1.0 .* integrator.f.jac_prototype
183185
J.nzval .= 0.0
@@ -200,7 +202,9 @@ function calc_J!(J, integrator, cache, next_step::Bool = false)
200202

201203
# we need to set all nzval to a non-zero number
202204
# otherwise in the following line any zero gets interpreted as a structural zero
203-
if !isnothing(integrator.f.jac_prototype)
205+
if !isnothing(integrator.f.jac_prototype) &&
206+
integrator.f.jac_prototype isa SparseMatrixCSC
207+
204208
integrator.f.jac_prototype.nzval .= 1.0
205209
J .= 1.0 .* integrator.f.jac_prototype
206210
J.nzval .= 0.0

0 commit comments

Comments
 (0)