# TaoSetConvergenceTest
Sets the function that is to be used to test for convergence o fthe iterative minimization solution.  The new convergence testing routine will replace Tao's default convergence test. 
## Synopsis
```
#include "petsctao.h" 
PetscErrorCode TaoSetConvergenceTest(Tao tao, PetscErrorCode (*conv)(Tao, void *), void *ctx)
```
Logically Collective on tao


## Input Parameters

- ***tao -*** the Tao object
- ***conv -*** the routine to test for convergence
- ***ctx -*** [optional] context for private data for the convergence routine
(may be NULL)



## Calling sequence of conv
```none
PetscErrorCode conv(Tao tao, void *ctx)
```


- ***tao -*** the Tao object
- ***ctx -*** [optional] convergence context



## Note
The new convergence testing routine should call `TaoSetConvergedReason()`.




## See Also
 `Tao`, `TaoSolve()`, `TaoSetConvergedReason()`, `TaoGetSolutionStatus()`, `TaoGetTolerances()`, `TaoSetMonitor`


## Level
advanced

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

## Examples
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/tao/unconstrained/tutorials/eptorsion2f.F90.html">src/tao/unconstrained/tutorials/eptorsion2f.F90.html</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/tao/bound/tutorials/jbearing2.c.html">src/tao/bound/tutorials/jbearing2.c.html</A><BR>


---
[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)  
