You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
function hessian(f::F, x) where F
n = length(f(x))
out = Enzyme.jacobian(Forward, x -> Enzyme.jacobian(Forward, f, x), x)
return reshape(out, (n, eachindex(x), eachindex(x)))
end
function F!(res, x)
res[1] = x[1]^2 + x[2]^2 - 2
return res[2] = exp(x[1] - 1) + x[2]^2 - 2
end
function F(x)
res = similar(x)
F!(res, x)
return res
end
I was playing around with JuliaDiff/ForwardDiff.jl#61 (comment) to calculate the hessian of a vector-valued function.
The text was updated successfully, but these errors were encountered: