Closed astro-kevin closed 1 week ago
It should be
ForwardDiff.derivative.((test,), [0.5, 1.5])
Need to broadcast test
as well.
julia> ForwardDiff.derivative.((test,), [0.5, 1.5])
2-element Vector{Float64}:
1.0
1.0
julia> map(x->ForwardDiff.derivative(test,x), [0.5,1.5])
2-element Vector{Float64}:
1.0
1.0
Thanks.
Describe the bug π
When trying to vectorize derivatives in ForwardDiff (i.e. compute derivatives for a vector), a
MethodError
is thrown instead of the expected behavior.Expected behavior
That the derivative be computed for the entire vector.
Quick edit: I expected the result to be identical to the code here:
map(x->ForwardDiff.derivative(test,x), [0.5,1.5])
Minimal Reproducible Example π
Error & Stacktrace β οΈ
Environment (please complete the following information):
using Pkg; Pkg.status()
using Pkg; Pkg.status(; mode = PKGMODE_MANIFEST)
versioninfo()