Given a function `f(x)`

from R^2 -> R, is there an efficient way to calculate just the diagonal entries of the Hessian matrix using any of the autodiff tools? I know that at the function’s max, all the off-diagonal partials are zero, e.g.

```
using ForwardDiff
f(x) = dot(x, x)
ForwardDiff.hessian(f, [0.0, 0.0])
# 2×2 Array{Float64,2}:
# 2.0 0.0
# 0.0 2.0
```

In reality, the function is more complicated and the dimension of `x`

might be much larger, such that computing the whole Hessian might use up all my memory. Hacky solutions are fine for my current purposes. Thanks in advance!