# SNESLineSearchSetType
Sets the linesearch type 
## Synopsis
```
#include "petscsnes.h" 
PetscErrorCode SNESLineSearchSetType(SNESLineSearch linesearch, SNESLineSearchType type)
```
Logically Collective


## Input Parameters

- ***linesearch -*** linesearch context
- ***type -*** The type of line search to be used



## Available Types

- ***`SNESLINESEARCHBASIC` -*** (or equivalently `SNESLINESEARCHNONE`) Simple damping line search, defaults to using the full Newton step
- ***`SNESLINESEARCHBT` -*** Backtracking line search over the L2 norm of the function
- ***`SNESLINESEARCHL2` -*** Secant line search over the L2 norm of the function
- ***`SNESLINESEARCHCP` -*** Critical point secant line search assuming F(x) = grad G(x) for some unknown G(x)
- ***`SNESLINESEARCHNLEQERR` -*** Affine-covariant error-oriented linesearch
- ***`SNESLINESEARCHSHELL` -*** User provided `SNESLineSearch` implementation



## Options Database Key

- ***-snes_linesearch_type <type> -*** basic (or equivalently none), bt, l2, cp, nleqerr, shell





## See Also
  `SNESLineSearch`, `SNESLineSearchType`, `SNESLineSearchCreate()`, `SNESLineSearchType`, `SNESLineSearchSetFromOptions()`, `SNESLineSearchGetType()`

## Level
intermediate

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/snes/linesearch/interface/linesearch.c.html#SNESLineSearchSetType">src/snes/linesearch/interface/linesearch.c</A>

## Examples
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/snes/tutorials/ex1f.F90.html">src/snes/tutorials/ex1f.F90.html</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ts/tutorials/ex22.c.html">src/ts/tutorials/ex22.c.html</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ts/tutorials/ex22f.F90.html">src/ts/tutorials/ex22f.F90.html</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ts/utils/dmplexlandau/tutorials/ex1.c.html">src/ts/utils/dmplexlandau/tutorials/ex1.c.html</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ts/utils/dmplexlandau/tutorials/ex1f90.F90.html">src/ts/utils/dmplexlandau/tutorials/ex1f90.F90.html</A><BR>


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


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