Skip to content

Commit fe2296b

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

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

test/jacobiansparsity.jl

Lines changed: 4 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,9 @@ 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+
t = 0.0
63+
@test (@ballocated $(prob.f.jac.f_iip)($out, $u0, $p, $t)) == 0 # should not allocate
6164

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

0 commit comments

Comments
 (0)