TaoSetTolerances — PETSc 3.22.5 documentation

Skip to main content
`Ctrl`+`K`

# TaoSetTolerances

Sets parameters used in `TaoSolve()` convergence tests

## Synopsis

    #include "petsctao.h"
    PetscErrorCode TaoSetTolerances(Tao tao, PetscReal gatol, PetscReal grtol, PetscReal gttol)

Logically Collective

## Input Parameters

- tao - the `Tao` context

- gatol - stop if norm of gradient is less than this

- grtol - stop if relative norm of gradient is less than this

- gttol - stop if norm of gradient is reduced by this factor

## Options Database Keys

- -tao_gatol - Sets gatol

- -tao_grtol - Sets grtol

- -tao_gttol - Sets gttol

Stopping Criteria:

      ||g(X)||                            <= gatol
      ||g(X)|| / |f(X)|                   <= grtol
      ||g(X)|| / ||g(X0)||                <= gttol

## Notes

Use `PETSC_CURRENT` to leave one or more tolerances unchanged.

Use `PETSC_DETERMINE` to set one or more tolerances to their values when the `tao`object’s type was set

## Fortran Note

Use `PETSC_CURRENT_REAL` or `PETSC_DETERMINE_REAL`

## See Also

TAO: Optimization Solvers, `Tao`, `TaoConvergedReason`, `TaoGetTolerances()`

## Level

beginner

## Location

src/tao/interface/taosolver.c

## Examples

src/tao/unconstrained/tutorials/spectraladjointassimilation.c
src/tao/constrained/tutorials/ex1.c
src/tao/unconstrained/tutorials/burgers_spectral.c
src/tao/unconstrained/tutorials/rosenbrock2.c
src/tao/unconstrained/tutorials/rosenbrock3.c
src/tao/constrained/tutorials/maros.c

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