TaoTermComputeHessianFD — PETSc 3.25.2 documentation

Skip to main content
`Ctrl`+`K`

# TaoTermComputeHessianFD

Use finite difference to compute Hessian matrix.

## Synopsis

    #include "petsctao.h"
    PetscErrorCode TaoTermComputeHessianFD(TaoTerm term, Vec x, Vec params, Mat H, Mat Hpre)

Collective

## Input Parameters

- term - a `TaoTerm`

- x - a solution vector

- params - parameters vector (may be `NULL`, see `TaoTermParametersMode`)

## Output Parameters

- H - (optional) Hessian matrix

- Hpre - (optional) Hessian preconditioning matrix

## Options Database Keys

- -tao_term_fd_delta - change in X used to calculate finite differences

- -tao_term_hessian_use_fd - Use `TaoTermComputeHessianFD()` in `TaoTermComputeHessian()`

## Notes

This routine is slow and expensive, and is not optimized to take advantage of sparsity in the problem. Although not recommended for general use in large-scale applications, it can be useful in checking the correctness of a user-provided Hessian. Call `TaoTermComputeHessianSetUseFD()` to start using this routine in `TaoTermComputeHessian()`.

## See Also

TaoTerm: composable objective function terms, `TaoTerm`, `TaoTermComputeHessian()`, `TaoTermGetFDDelta()`, `TaoTermSetFDDelta()`, `TaoTermComputeHessianSetUseFD()`, `TaoTermComputeHessianGetUseFD()`

## Level

advanced

## Location

src/tao/term/utils/taotermfdiff.c

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