More efficient implementation of Hessian in FlatDyn.
Accept dxl as a template argument to avoid double differentiation.