# TaoDefaultComputeHessian
Computes the Hessian using finite differences. 
## Synopsis
```
#include "petsctao.h"  
PetscErrorCode TaoDefaultComputeHessian(Tao tao, Vec V, Mat H, Mat B, void *dummy)
```
Collective


## Input Parameters

- ***tao   -*** the Tao context
- ***V     -*** compute Hessian at this point
- ***dummy -*** not used



## Output Parameters

- ***H -*** Hessian matrix (not altered in this routine)
- ***B -*** newly computed Hessian matrix to use with preconditioner (generally the same as H)



## Options Database Key

- ***-tao_fd_hessian -*** activates TaoDefaultComputeHessian()





## Notes
This routine is slow and expensive, and is not optimized
to take advantage of sparsity in the problem.  Although
it is not recommended for general use
in large-scale applications, It can be useful in checking the
correctness of a user-provided Hessian.


## See Also
 `Tao`, `TaoSetHessian()`, `TaoDefaultComputeHessianColor()`, `SNESComputeJacobianDefault()`, `TaoSetGradient()`, `TaoDefaultComputeGradient()`

## Level
advanced

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/tao/interface/fdiff.c.html#TaoDefaultComputeHessian">src/tao/interface/fdiff.c</A>

## Examples
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/tao/unconstrained/tutorials/minsurf2.c.html">src/tao/unconstrained/tutorials/minsurf2.c.html</A><BR>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/tao/interface/fdiff.c)


[Index of all Tao routines](index.md)  
[Table of Contents for all manual pages](/docs/manualpages/index.md)  
[Index of all manual pages](/docs/manualpages/singleindex.md)  
