# KSPSetGuess
Set the initial guess object 
## Synopsis
```
#include "petscksp.h" 
PetscErrorCode KSPSetGuess(KSP ksp, KSPGuess guess)
```
Logically Collective


## Input Parameters

- ***ksp -*** the Krylov context
- ***guess -*** the object created with `KSPGuessCreate()`





## Notes
this allows a single `KSP` to be used with several different initial guess generators (likely for different linear
solvers, see `KSPSetPC()`).

This increases the reference count of the guess object, you must destroy the object with `KSPGuessDestroy()`
before the end of the program.


## See Also
 [](chapter_ksp), `KSP`, `KSPGuess`, `KSPSetOptionsPrefix()`, `KSPAppendOptionsPrefix()`, `KSPSetUseFischerGuess()`, `KSPGetGuess()`

## Level
advanced

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ksp/ksp/interface/itcl.c.html#KSPSetGuess">src/ksp/ksp/interface/itcl.c</A>


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


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