Skip to content

Commit 8666e05

Browse files
committed
Counter for jacobians
1 parent ee04297 commit 8666e05

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/jacobian.jl

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ jacobian!!(J, _) = J
3434
# and we don't want wasteful `copyto!`
3535
function jacobian!!(J::Union{AbstractMatrix{<:Number}, Nothing}, cache)
3636
@unpack f, uf, u, p, jac_cache, alg, fu_cache = cache
37+
cache.stats.njacs += 1
3738
iip = isinplace(cache)
3839
if iip
3940
if has_jac(f)
@@ -53,8 +54,10 @@ function jacobian!!(J::Union{AbstractMatrix{<:Number}, Nothing}, cache)
5354
end
5455
end
5556
# Scalar case
56-
jacobian!!(::Number, cache) = last(value_derivative(cache.uf, cache.u))
57-
57+
function jacobian!!(::Number, cache)
58+
cache.stats.njacs += 1
59+
return last(value_derivative(cache.uf, cache.u))
60+
end
5861
# Build Jacobian Caches
5962
function jacobian_caches(alg::AbstractNonlinearSolveAlgorithm, f::F, u, p, ::Val{iip};
6063
linsolve_kwargs = (;), lininit::Val{linsolve_init} = Val(true),

0 commit comments

Comments
 (0)