slepc-3.21.1 2024-04-26
Report Typos and Errors

# PEPSetEigenvalueComparison

Specifies the eigenvalue comparison function when PEPSetWhichEigenpairs() is set to PEP_WHICH_USER.

### Synopsis

    #include "slepcpep.h"
    PetscErrorCode PEPSetEigenvalueComparison(PEP pep,PetscErrorCode (*comp)(PetscScalar ar,PetscScalar ai,PetscScalar br,PetscScalar bi,PetscInt *res,void *ctx),void* ctx)

Logically Collective

### Input Parameters

| pep | - eigensolver context obtained from PEPCreate()
| comp | - a pointer to the comparison function
| ctx | - a context pointer (the last parameter to the comparison function)

### Calling sequence of comp

     PetscErrorCode comp(PetscScalar ar,PetscScalar ai,PetscScalar br,PetscScalar bi,PetscInt *res,void *ctx)

| ar | - real part of the 1st eigenvalue
| ai | - imaginary part of the 1st eigenvalue
| br | - real part of the 2nd eigenvalue
| bi | - imaginary part of the 2nd eigenvalue
| res | - result of comparison
| ctx | - optional context, as set by PEPSetEigenvalueComparison()

### Note

The returning parameter 'res' can be

| negative | - if the 1st eigenvalue is preferred to the 2st one
| zero | - if both eigenvalues are equally preferred
| positive | - if the 2st eigenvalue is preferred to the 1st one

### See Also

PEPSetWhichEigenpairs(), PEPWhich

### Level

advanced

### Location

src/pep/interface/pepopts.c

### Examples

src/pep/tutorials/nlevp/pdde_stability.c
Index of all PEP routines
Table of Contents for all manual pages
Index of all manual pages