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

Commit 82eee1a

Browse files
committed
Update VecJac to new f signature
1 parent c20400a commit 82eee1a

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

src/differentiation/vecjac_products.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,16 +77,16 @@ end
7777

7878
# Interpret the call as df/du' * u
7979
function (L::RevModeAutoDiffVecProd)(v, p, t)
80-
L.vecprod(_u -> L.f(_u, p, t), L.u, v)
80+
L.vecprod(L.f, L.u, v)
8181
end
8282

8383
# prefer non in-place method
8484
function (L::RevModeAutoDiffVecProd{ad,iip,true})(dv, v, p, t) where{ad,iip}
85-
L.vecprod!(dv, _u -> L.f(_u, p, t), L.u, v, L.cache...)
85+
L.vecprod!(dv, L.f, L.u, v, L.cache...)
8686
end
8787

8888
function (L::RevModeAutoDiffVecProd{ad,true,false})(dv, v, p, t) where{ad}
89-
L.vecprod!(dv, (_du, _u) -> L.f(_du, _u, p, t), L.u, v, L.cache...)
89+
L.vecprod!(dv, L.f, L.u, v, L.cache...)
9090
end
9191

9292
function VecJac(f, u::AbstractArray, p = nothing, t = nothing; autodiff = AutoFiniteDiff(),
@@ -102,11 +102,11 @@ function VecJac(f, u::AbstractArray, p = nothing, t = nothing; autodiff = AutoFi
102102

103103
cache = (similar(u), similar(u),)
104104

105-
outofplace = static_hasmethod(f, typeof((u, p, t)))
106-
isinplace = static_hasmethod(f, typeof((u, u, p, t)))
105+
outofplace = static_hasmethod(f, typeof((u,)))
106+
isinplace = static_hasmethod(f, typeof((u, u,)))
107107

108108
if !(isinplace) & !(outofplace)
109-
error("$f must have signature f(u, p, t), or f(du, u, p, t)")
109+
error("$f must have signature f(u), or f(du, u)")
110110
end
111111

112112
L = RevModeAutoDiffVecProd(f, u, cache, vecprod, vecprod!; autodiff = autodiff,

0 commit comments

Comments
 (0)