# TaoSetUpdate
Sets the general-purpose update function called at the beginning of every iteration of the optimization algorithm. Specifically it is called at the top of every iteration, after the new solution and the gradient is determined, but before the Hessian is computed (if applicable). 
## Synopsis
```
#include "petsctao.h" 
PetscErrorCode TaoSetUpdate(Tao tao, PetscErrorCode (*func)(Tao, PetscInt, void *), void *ctx)
```
Logically Collective on tao


## Input Parameters

- ***tao -*** The tao solver context
- ***func -*** The function



## Calling sequence of func
```none
func (Tao tao, PetscInt step);
```


- ***step -*** The current step of the iteration





## See Also
 `Tao`, `TaoSolve()`

## Level
advanced

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


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/tao/interface/taosolver.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)  
