I have carefully verified my ehess derivation, but I still get this result when I run checkhessian(problem). Is there a problem with my derivation or code?
result:
# Hessian check
The slope should be 3. It appears to be: 2.00143.
If it is far from 3, then the gradient or the Hessian might be erroneous.
Hess f(x)[d] must be a tangent vector at x.
If so, the following number is zero up to machine precision: 2.52699e-16.
If it is far from 0, the Hessian returns non-tangent vectors.
The Hessian at x must be linear on the tangent space at x.
If so, ||a*H[d1] + b*H[d2] - H[a*d1+b*d2]|| is zero up to machine precision.
Value: 1.90364e-15 (norm of H[a*d1+b*d2]: 8.5303)
If it is far from 0, then the Hessian is not linear.
The Hessian at x must be symmetric on the tangent space at x.
If so, <d1, H[d2]> - <H[d1], d2> is zero up to machine precision.
Value: 2.07333 - 2.07333 = 4.44089e-16.
If it is far from 0, then the Hessian is not symmetric.