From f05b38b97e73c20aba58a1e9286a6eca52608895 Mon Sep 17 00:00:00 2001 From: Christopher Rackauckas Date: Sun, 22 Dec 2024 11:45:55 -0100 Subject: [PATCH] Fix AutoFiniteDiff caching Adds the third cache to be truly non-allocating --- src/differentiation/jaches_products.jl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/differentiation/jaches_products.jl b/src/differentiation/jaches_products.jl index 04c00917..aa589565 100644 --- a/src/differentiation/jaches_products.jl +++ b/src/differentiation/jaches_products.jl @@ -268,8 +268,9 @@ function JacVec(f, u::AbstractArray, p = nothing, t = nothing; fu = nothing, cache, vecprod, vecprod! = if autodiff isa AutoFiniteDiff cache1 = similar(fu) cache2 = similar(u) + cache3 = similar(u) - (cache1, cache2), num_jacvec, num_jacvec! + (cache1, cache2, cache3), num_jacvec, num_jacvec! elseif autodiff isa AutoForwardDiff cache1 = Dual{ typeof(ForwardDiff.Tag(tag, eltype(u))), eltype(u), 1