33. Hessian Evaluation

Some optimization routines also require a Hessian matrix from the user. The routine that evaluates the Hessian should have the form:

   EvaluateTheHessian(TAO_APPLICATION,Vec,Mat*,Mat*,MatStructure*,void*); 
The first argument of this routine is a TAO application. The second argument is the point at which the Hessian should be evaluated. The third argument is the Hessian matrix, and the sixth argument is a user-defined context. Since the Hessian matrix is usually used in solving a system of linear equations, a preconditioner for the matrix is often needed. The fourth argument is the matrix that will be used for preconditioning the linear system. In most cases, this matrix will be the same as the Hessian matrix. The fifth argument is the flag used to set the Hessian matrix and linear solver in the routine KSPSetOperators().

One can set the Hessian evaluation routine by calling

   int TaoAppSetHessianRoutine(TAO_APPLICATION, 
                int (*)(TAO_APPLICATION,Vec,Mat*,Mat*,MatStructure*,void*), 
                void *) 
The first argument is the TAO application, the second argument is the function that evaluates the Hessian, and the third argument is a pointer to a user defined context, cast as a void* pointer.

For solvers that evaluate the Hessian, the matrices used to store the Hessian should be set using

   TaoAppSetHessianMat(TAO_APPLICATION,Mat,Mat); 
The first argument is the TAO application, the second argument is the Hessian matrix, and the third argument is the preconditioning matrix. In most applications, these two matrices will be the same structure.