JuliaDiff / ForwardDiff.jl

Forward Mode Automatic Differentiation for Julia
Other
873 stars 141 forks source link

Hessian should be symmetric #253

Open dpsanders opened 6 years ago

dpsanders commented 6 years ago

The Hessian of a function f is a symmetric matrix if f is smooth enough. Is there a way of having this information made available? I guess not just by returning a SymmetricMatrix, due to type stability.

FJRubio67 commented 5 months ago

I have the same problem. I have obtained non-symmetric hessian matrices when using ForwardDiff.hessian. This problem seems to appear when the dimension is higher than 3.

A hackish workaround I am currently using is replacing the lower diagonal by the upper diagonal, but this is a suboptimal strategy.