Closed
Description
julia> using FiniteDiff
julia> f(x) = sum(abs2, x)
f (generic function with 1 method)
julia> x1, x2 = float.(1:4), float.(5:8);
julia> FiniteDiff.finite_difference_hessian(f, x1, FiniteDiff.HessianCache(x1))
4×4 LinearAlgebra.Symmetric{Float64, Matrix{Float64}}:
2.0 0.0 0.0 0.0
0.0 2.0 0.0 0.0
0.0 0.0 2.0 0.0
0.0 0.0 0.0 2.0
julia> FiniteDiff.finite_difference_hessian(f, x1, FiniteDiff.HessianCache(x2))
4×4 LinearAlgebra.Symmetric{Float64, Matrix{Float64}}:
1.61061e10 0.0 0.0 0.0
0.0 2.0 0.0 0.0
0.0 0.0 2.0 0.0
0.0 0.0 0.0 2.0