petsc-3.12.4 2020-02-04
Report Typos and Errors

# KSPSetComputeInitialGuess

set routine to compute the initial guess of the linear system

### Synopsis

    #include "petscksp.h"
    PetscErrorCode KSPSetComputeInitialGuess(KSP ksp,PetscErrorCode (*func)(KSP,Vec,void*),void *ctx)

Logically Collective

### Input Arguments

| ksp | - the KSP context
| func | - function to compute the initial guess
| ctx | - optional context

### Calling sequence of func

     func(KSP ksp,Vec x,void *ctx)

| ksp | - the KSP context
| x | - solution vector
| ctx | - optional user-provided context

Notes: This should only be used in conjunction with KSPSetComputeRHS(), KSPSetComputeOperators(), otherwise call KSPSetInitialGuessNonzero() and set the initial guess values in the solution vector passed to KSPSolve().

### See Also

KSPSolve(), KSPSetComputeRHS(), KSPSetComputeOperators(), DMKSPSetComputeInitialGuess()

### Level

beginner

### Location

src/ksp/ksp/interface/itfunc.c

### Examples

src/ksp/ksp/examples/tutorials/ex45.c.html
src/ksp/ksp/examples/tutorials/ex45f.F90.html
Index of all KSP routines
Table of Contents for all manual pages
Index of all manual pages