Use Fortran function for Jac and Hessian