# Computation of Riemannian Hessian

22 views

### Poo Uoo

Apr 11, 2023, 11:57:53 AMApr 11
to Manopt
Hello,
I have a cost function to minimize. The cost function and the corresponding Euclidean gradient are given as follows. I want to employ the trustregions algorithm to minimize it. Then, how to calculated the Euclidean Hessian or Riemainnian Hessian of it? problem.ehess = "xxxxx" ?
Thanks very much!
Robert ### Nicolas Boumal

Apr 12, 2023, 6:55:47 AMApr 12
to Manopt
Hello Robert,

For the Euclidean Hessian, you need to derive an expression for the directional derivative of Grad f at a point "w" along a direction "wdot".
Then, problem.ehess = @(w, wdot) ... that expression you found ...;
After working this out, it's always a good idea to call checkgradient(problem) and checkhessian(problem) to check your work.

You may find section 4.7 of my book useful to learn how to work out directional derivatives of vector functions.

In your case, since you already managed to find the gradient (and I imagine it passed the "checkgradient" test?), you likely already have the skills necessary to work out the Hessian.

For example; the directional derivative of the map w -> 2 P w  at w along wdot is simplyy (w, wdot) -> 2 P wdot.
And the directional derivative of w -> 1/(w*Qw)  at w along wdot is  (w, wdot) -> (-1/(w*Qw)²) ( wdot* Q w + w* Q wdot ).
It's now a matter of chaining such reasonings together to get your formula.

There is one thing to keep in mind here, which is that your variable w seems to be a complex vector. That's perfectly fine, but if it seems to give you trouble, you may want to figure out the expressions for the real case first (and do tell manopt to work on a real space), use checkgradient + checkhessian to make sure it's all good, then see how you can "upgrade" that to the complex case.

Don't hesitate if you run into more questions along the way.

Best,
Nicolas