TaoSetHessian — PETSc 3.23.0 documentation

Skip to main content
`Ctrl`+`K`

# TaoSetHessian

Sets the function to compute the Hessian as well as the location to store the matrix.

## Synopsis

    #include "petsctao.h"
    PetscErrorCode TaoSetHessian(Tao tao, Mat H, Mat Hpre, PetscErrorCode (*func)(Tao tao, Vec x, Mat H, Mat Hpre, void *ctx), void *ctx)

Logically Collective

## Input Parameters

- tao - the `Tao` context

- H - Matrix used for the hessian

- Hpre - Matrix that will be used to construct the preconditioner, can be same as `H`

- func - Hessian evaluation routine

- ctx - [optional] user-defined context for private data for the Hessian evaluation routine (may be `NULL`)

## Calling sequence of `func`

- tao - the `Tao` context

- x - input vector

- H - Hessian matrix

- Hpre - matrix used to construct the preconditioner, usually the same as `H`

- ctx - [optional] user-defined Hessian context

## See Also

TAO: Optimization Solvers, `Tao`, `TaoTypes`, `TaoSetObjective()`, `TaoSetGradient()`, `TaoSetObjectiveAndGradient()`, `TaoGetHessian()`

## Level

beginner

## Location

src/tao/interface/taosolver_hj.c

## Examples

src/tao/unconstrained/tutorials/eptorsion2.c
src/tao/unconstrained/tutorials/eptorsion3.c
src/tao/unconstrained/tutorials/eptorsion1.c
src/tao/bound/tutorials/jbearing2.c
src/tao/constrained/tutorials/maros.c
src/tao/constrained/tutorials/ex1.c
src/tao/bound/tutorials/plate2f.F90
src/tao/bound/tutorials/plate2.c
src/tao/tutorials/ex4.c
src/tao/constrained/tutorials/tomographyADMM.c

Index of all Tao routines
Table of Contents for all manual pages
Index of all manual pages