KSPGCRSetModifyPC — PETSc 3.22.5 documentation

Skip to main content
`Ctrl`+`K`

# KSPGCRSetModifyPC

Sets the routine used by `KSPGCR` to modify the preconditioner for each iteration

## Synopsis

    #include "petscksp.h"
    PetscErrorCode KSPGCRSetModifyPC(KSP ksp, PetscErrorCode (*function)(KSP ksp, PetscInt n, PetscReal rnorm, void *ctx), void *ctx, PetscErrorCode (*destroy)(void *ctx))

Logically Collective

## Input Parameters

- ksp - iterative context obtained from `KSPCreate()`

- function - user defined function to modify the preconditioner

- ctx - user provided context for the modify preconditioner function

- destroy - the function to use to destroy the user provided application context.

## Calling sequence of `function`

- ksp - iterative context

- n - the total number of `PCGCR` iterations that have occurred

- rnorm - 2-norm residual value

- ctx - the user provided application context

## Calling sequence of `destroy`

- ctx - the user provided application context

## Note

The default modifypc routine is `KSPGCRModifyPCNoChange()`

## Developer Note

The API should make uniform for all flexible types, Flexible Krylov Methods, and not have separate function calls for each type.

## See Also

KSP: Linear System Solvers, `KSP`, `KSPGCR`, `KSPGCRModifyPCNoChange()`, Flexible Krylov Methods

## Level

intermediate

## Location

src/ksp/ksp/impls/gcr/gcr.c

## Implementations

KSPGCRSetModifyPC_GCR() in src/ksp/ksp/impls/gcr/gcr.c

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