# SNESNCGSetType
Sets the conjugate update type for nonlinear CG `SNESNCG`. 
## Synopsis
```
#include "petscsnes.h" 
PetscErrorCode SNESNCGSetType(SNES snes, SNESNCGType btype)
```
Logically Collective on snes


## Input Parameters

- ***snes -*** the iterative context
- ***btype -*** update type



## Options Database Key

- ***-snes_ncg_type <prp,fr,hs,dy,cd> -*** strategy for selecting algorithm for computing beta





## `SNESNCGType`s

- ***`SNES_NCG_FR` -*** Fletcher-Reeves update
- ***`SNES_NCG_PRP` -*** Polak-Ribiere-Polyak update
- ***`SNES_NCG_HS` -*** Hestenes-Steifel update
- ***`SNES_NCG_DY` -*** Dai-Yuan update
- ***`SNES_NCG_CD` -*** Conjugate Descent update



## Notes
`SNES_NCG_PRP` is the default, and the only one that tolerates generalized search directions.

It is not clear what "generalized search directions" means, does it mean use with a nonlinear preconditioner,
that is using -npc_snes_type <type>, `SNESSetNPC()`, or `SNESGetNPC()`?


## Developer Note
There should be a `SNESNCGSetType()`


## See Also
 `SNESNCGType`, `SNES_NCG_FR`, `SNES_NCG_PRP`, `SNES_NCG_HS`, `SNES_NCG_DY`, `SNES_NCG_CD`

## Level
intermediate

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/snes/impls/ncg/snesncg.c.html#SNESNCGSetType">src/snes/impls/ncg/snesncg.c</A>

## Implementations

<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/snes/impls/ncg/snesncg.c.html#SNESNCGSetType_NCG">SNESNCGSetType_NCG in src/snes/impls/ncg/snesncg.c</A><BR>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/snes/impls/ncg/snesncg.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)  
