Skip to content

Cannot reuse HessianCache for another value of x #185

Closed
@gdalle

Description

@gdalle
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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions