Fast Hessian size increase

This makes me think you actually have a \mathbb{R}^2\rightarrow\mathbb{R} function and you want to evaluate the hessian at n distinct points (e.g if your array is (2,10) at 10 points) is this what you want to do?

A possible way I can think of is the following (there might be better ones)

julia> f(x) = sum(x.^3)
f (generic function with 1 methods)

julia> pnts = [[1,2], [3,4], [5,6], [7,8]]
4-element Vector{Vector{Int64}}:
 [1, 2]
 [3, 4]
 [5, 6]
 [7, 8]

julia> ForwardDiff.hessian.(f, pnts)
4-element Vector{Matrix{Int64}}:
 [6 0; 0 12]
 [18 0; 0 24]
 [30 0; 0 36]
 [42 0; 0 48]
3 Likes