TaoComputeHessian — PETSc 3.22.5 documentation

Skip to main content
`Ctrl`+`K`

# TaoComputeHessian

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

## Synopsis

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

Collective

## 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 - 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 optimization algorithms, so most users would not generally call this routine themselves.

## Developer Notes

The Hessian test mechanism follows `SNESTestJacobian()`.

## See Also

TAO: Optimization Solvers, `Tao`, `TaoComputeObjective()`, `TaoComputeObjectiveAndGradient()`, `TaoSetHessian()`

## 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