Skip to main content
`Ctrl`+`K`

# KSPRegister

Adds a method, `KSPType`, to the Krylov subspace solver package.

## Synopsis

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

Not Collective, No Fortran Support

## Input Parameters

- sname - name of a new user-defined solver

- function - routine to create method

## Note

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

## Example Usage

       KSPRegister("my_solver", MySolverCreate);

Then, your solver can be chosen with the procedural interface via

      KSPSetType(ksp, "my_solver")

or at runtime via the option `-ksp_type my_solver`

## See Also

KSP: Linear System Solvers, `KSP`, `KSPType`, `KSPSetType`, `KSPRegisterAll()`

## Level

advanced

## Location

src/ksp/ksp/interface/itcreate.c

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