# SNESSetComputeInitialGuess
Sets a routine used to compute an initial guess for the problem 
## Synopsis
```
#include "petscsnes.h"  
PetscErrorCode SNESSetComputeInitialGuess(SNES snes, PetscErrorCode (*func)(SNES, Vec, void *), void *ctx)
```
Logically Collective on snes


## Input Parameters

- ***snes -*** the `SNES` context
- ***func -*** function evaluation routine
- ***ctx -*** [optional] user-defined context for private data for the
function evaluation routine (may be NULL)



## Calling sequence of func
```none
func (SNES snes,Vec x,void *ctx);
```


- ***f -*** function vector


- ***ctx -*** optional user-defined function context





## See Also
 `SNES`, `SNESSolve()`, `SNESGetFunction()`, `SNESComputeFunction()`, `SNESSetJacobian()`

## Level
intermediate

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

## Examples
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/snes/tutorials/ex18.c.html">src/snes/tutorials/ex18.c.html</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/snes/tutorials/ex48.c.html">src/snes/tutorials/ex48.c.html</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/snes/tutorials/ex58.c.html">src/snes/tutorials/ex58.c.html</A><BR>


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