Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot reuse HessianCache for another value of x #185

Closed
gdalle opened this issue Apr 16, 2024 · 2 comments · Fixed by #186
Closed

Cannot reuse HessianCache for another value of x #185

gdalle opened this issue Apr 16, 2024 · 2 comments · Fixed by #186
Labels

Comments

@gdalle
Copy link
Member

gdalle commented Apr 16, 2024

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
@gdalle
Copy link
Member Author

gdalle commented Apr 16, 2024

Awesome, thanks! Can we tag a release?

@ChrisRackauckas
Copy link
Member

Tagged a half hour before you asked JuliaRegistries/General#105009

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants