KSPGuessRegister — PETSc 3.25.0 documentation

Skip to main content
`Ctrl`+`K`

# KSPGuessRegister

Registers a method for initial guess computation in Krylov subspace solver package.

## Synopsis

    #include "petscksp.h"
    PetscErrorCode KSPGuessRegister(const char sname[], PetscErrorCode (*function)(KSPGuess))

Not Collective, No Fortran Support

## Input Parameters

- sname - name of a new user-defined solver

- function - routine to create method context

## Example Usage

       KSPGuessRegister("my_initial_guess", MyInitialGuessCreate);

Then, it can be chosen with the procedural interface via

      KSPGetGuess(ksp, &guess);
      KSPGuessSetType(guess, "my_initial_guess");

or at runtime via the option `-ksp_guess_type my_initial_guess`

## Note

`KSPGuessRegister()` may be called multiple times to add several user-defined solvers.

## See Also

KSP: Linear System Solvers, `KSPGuess`, `KSPGuessRegisterAll()`

## Level

developer

## Location

src/ksp/ksp/interface/iguess.c

Index of all KSP routines
Table of Contents for all manual pages
Index of all manual pages