slepc-3.18.2 2023-01-26
Report Typos and Errors

# NEPSetStoppingTestFunction

Sets a function to decide when to stop the outer iteration of the eigensolver.

### Synopsis

    #include "slepcnep.h"
    PetscErrorCode NEPSetStoppingTestFunction(NEP nep,PetscErrorCode (*func)(NEP,PetscInt,PetscInt,PetscInt,PetscInt,NEPConvergedReason*,void*),void* ctx,PetscErrorCode (*destroy)(void*))

Logically Collective on nep

### Input Parameters

| nep | - nonlinear eigensolver context obtained from NEPCreate()
| func | - pointer to the stopping test function
| ctx | - context for private data for the stopping routine (may be null)
| destroy | - a routine for destroying the context (may be null)

### Calling Sequence of func

      func(NEP nep,PetscInt its,PetscInt max_it,PetscInt nconv,PetscInt nev,NEPConvergedReason *reason,void *ctx)

| nep | - nonlinear eigensolver context obtained from NEPCreate()
| its | - current number of iterations
| max_it | - maximum number of iterations
| nconv | - number of currently converged eigenpairs
| nev | - number of requested eigenpairs
| reason | - (output) result of the stopping test
| ctx | - optional context, as set by NEPSetStoppingTestFunction()

### Note

Normal usage is to first call the default routine NEPStoppingBasic() and then set reason to NEP_CONVERGED_USER if some user-defined conditions have been met. To let the eigensolver continue iterating, the result must be left as NEP_CONVERGED_ITERATING.

### See Also

NEPSetStoppingTest(), NEPStoppingBasic()

### Level

advanced

### Location

src/nep/interface/nepopts.c
Index of all NEP routines
Table of Contents for all manual pages
Index of all manual pages