From 503d579b2465a472a41e07521df8bc58d55e7ad8 Mon Sep 17 00:00:00 2001 From: Avik Pal Date: Fri, 18 Aug 2023 17:44:18 -0400 Subject: [PATCH] Check jac_prototype usage --- test/sparse.jl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/sparse.jl b/test/sparse.jl index bb1d72ed8..1f4d07161 100644 --- a/test/sparse.jl +++ b/test/sparse.jl @@ -43,11 +43,13 @@ jac_sparsity = Symbolics.jacobian_sparsity((du, u) -> brusselator_2d_loop(du, u, u0) jac_prototype = float.(jac_sparsity) fill!(jac_prototype, 0) +@test all(iszero, jac_prototype) ff = NonlinearFunction(brusselator_2d_loop; jac_prototype) prob_brusselator_2d = NonlinearProblem(ff, u0, p) sol = solve(prob_brusselator_2d, NewtonRaphson()) @test norm(sol.resid) < 1e-8 +@test !all(iszero, jac_prototype) sol = solve(prob_brusselator_2d, NewtonRaphson(autodiff = false)) @test norm(sol.resid) < 1e-6