Skip to content

Commit e14cc64

Browse files
committed
Test that sparse+analytical iip Jacobian does not allocate
1 parent ac61c8a commit e14cc64

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

test/jacobiansparsity.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using ModelingToolkit, SparseArrays, OrdinaryDiffEq, DiffEqBase
1+
using ModelingToolkit, SparseArrays, OrdinaryDiffEq, DiffEqBase, BenchmarkTools
22

33
N = 3
44
xyd_brusselator = range(0, stop = 1, length = N)
@@ -58,6 +58,8 @@ prob = ODEProblem(sys, u0, (0, 11.5), sparse = true, jac = true)
5858
#@test_nowarn solve(prob, Rosenbrock23())
5959
@test findnz(calculate_jacobian(sys, sparse = true))[1:2] ==
6060
findnz(prob.f.jac_prototype)[1:2]
61+
out = similar(prob.f.jac_prototype)
62+
@test (@ballocated $(prob.f.jac.f_iip)($out, $(prob.u0), $(prob.p), 0.0)) == 0 # should not allocate
6163

6264
# test when not sparse
6365
prob = ODEProblem(sys, u0, (0, 11.5), sparse = false, jac = true)

0 commit comments

Comments
 (0)