KSPGetType — PETSc 3.25.4 documentation

Skip to main content
`Ctrl`+`K`

# KSPGetType

Gets the `KSP` type as a string from the `KSP` object.

## Synopsis

    #include "petscksp.h"
    PetscErrorCode KSPGetType(KSP ksp, KSPType *type)

Not Collective

## Input Parameter

- ksp - Krylov context

## Output Parameter

- type - name of the `KSP` method

## Note

`type` should not be retained for later use as it will be an invalid pointer if the `KSPType` of `ksp` is changed.

## See Also

KSP: Linear System Solvers, `KSPType`, `KSP`, `KSPSetType()`, `PetscObjectTypeCompare()`, `PetscObjectTypeCompareAny()`

## Level

intermediate

## Location

src/ksp/ksp/interface/itcreate.c

## Examples

src/ksp/ksp/tutorials/ex27.c
src/ksp/ksp/tutorials/ex57f.F90
src/ksp/ksp/tutorials/ex76.c

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