Skip to content

Commit ac61c8a

Browse files
committed
Check that checkbounds checks sparse iip Jacobian indices
1 parent 4d7e178 commit ac61c8a

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

test/jacobiansparsity.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,12 @@ f = DiffEqBase.ODEFunction(sys, u0 = nothing, sparse = true, jac = false)
7575
@test findnz(f.jac_prototype)[1:2] == findnz(JP)[1:2]
7676
@test eltype(f.jac_prototype) == Float64
7777

78+
# test sparsity index pattern checking
79+
f = DiffEqBase.ODEFunction(sys, u0 = nothing, sparse = true, jac = true, checkbounds = true)
80+
out = sparse([1.0 0.0; 0.0 1.0]) # choose a wrong size on purpose
81+
@test size(out) != size(f.jac_prototype) # check that the size is indeed wrong
82+
@test_throws AssertionError f.jac.f_iip(out, u0, p, 0.0) # check that we get an error
83+
7884
# test when u0 is not Float64
7985
u0 = similar(init_brusselator_2d(xyd_brusselator), Float32)
8086
prob_ode_brusselator_2d = ODEProblem(brusselator_2d_loop,

0 commit comments

Comments
 (0)