petsc-3.10.5 2019-03-28
Report Typos and Errors

# TaoComputeHessian

Computes the Hessian matrix that has been set with TaoSetHessianRoutine().

### Synopsis

    #include "petsctao.h"
    PetscErrorCode TaoComputeHessian(Tao tao, Vec X, Mat H, Mat Hpre)

Collective on Tao

### Input Parameters

| tao | - the Tao solver context
| X | - input vector

### Output Parameters

| H | - Hessian matrix
| Hpre | - Preconditioning matrix

### Options Database Keys

| -tao_test_hessian | - compare the user provided Hessian with one compute via finite differences to check for errors
| -tao_test_hessian <numerical value> | - display entries in the difference between the user provided Hessian and finite difference Hessian that are greater than a certain value to help users detect errors
| -tao_test_hessian_view | - display the user provided Hessian, the finite difference Hessian and the difference between them to help users detect the location of errors in the user provided Hessian

### Notes

Most users should not need to explicitly call this routine, as it is used internally within the minimization solvers.

TaoComputeHessian() is typically used within minimization implementations, so most users would not generally call this routine themselves.

### Developer Notes

The Hessian test mechanism follows SNESTestJacobian().

### See Also

TaoComputeObjective(), TaoComputeObjectiveAndGradient(), TaoSetHessianRoutine()

### Level

developer

### Location

src/tao/interface/taosolver_hj.c
Index of all Tao routines
Table of Contents for all manual pages
Index of all manual pages