Skip to content
This repository was archived by the owner on Aug 22, 2025. It is now read-only.

Commit 552cbc7

Browse files
vpuri3ChrisRackauckas
authored andcommitted
overload base.resize<bang>
1 parent 8d9a112 commit 552cbc7

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

src/differentiation/jaches_products.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,12 @@ function (L::FwdModeAutoDiffVecProd)(dv, v, p, t)
228228
L.vecprod!(dv, L.f, L.u, v, L.cache...)
229229
end
230230

231+
function Base.resize!(L::FwdModeAutoDiffVecProd, n::Integer)
232+
for v in L.cache
233+
resize!(v, n)
234+
end
235+
end
236+
231237
function JacVec(f, u::AbstractArray, p = nothing, t = nothing;
232238
autodiff = AutoForwardDiff(), tag = DeivVecTag(), kwargs...)
233239
cache, vecprod, vecprod! = if autodiff isa AutoFiniteDiff

src/differentiation/vecjac_products.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,12 @@ function (L::RevModeAutoDiffVecProd{ad, true, false})(dv, v, p, t) where {ad}
8787
L.vecprod!(dv, L.f, L.u, v, L.cache...)
8888
end
8989

90+
function Base.resize!(L::RevModeAutoDiffVecProd, n::Integer)
91+
for v in L.cache
92+
resize!(v, n)
93+
end
94+
end
95+
9096
function VecJac(f, u::AbstractArray, p = nothing, t = nothing; autodiff = AutoFiniteDiff(),
9197
kwargs...)
9298
vecprod, vecprod! = if autodiff isa AutoFiniteDiff

0 commit comments

Comments
 (0)