EPSSetArbitrarySelection — SLEPc 3.24.2 documentation

Skip to main content
`Ctrl`+`K`

# EPSSetArbitrarySelection

Specifies a function intended to look for eigenvalues according to an arbitrary selection criterion. This criterion can be based on a computation involving the current eigenvector approximation.

## Synopsis

    #include "slepceps.h"
    PetscErrorCode EPSSetArbitrarySelection(EPS eps,SlepcArbitrarySelectionFn *func,void *ctx)

Logically Collective

## Input Parameters

- eps - the linear eigensolver context

- func - the arbitrary selection function, see `SlepcArbitrarySelectionFn` for a calling sequence

- ctx - a context pointer (the last parameter to the arbitrary selection function)

## Notes

This provides a mechanism to select eigenpairs by evaluating a user-defined function. When a function has been provided, the default selection based on sorting the eigenvalues is replaced by the sorting of the results of this function (with the same sorting criterion given in `EPSSetWhichEigenpairs()`).

For instance, suppose you want to compute those eigenvectors that maximize a certain computable expression. Then implement the computation using the arguments `xr` and `xi`, and return the result in `rr`. Then set the standard sorting by magnitude so that the eigenpair with largest value of `rr` is selected.

This evaluation function is collective, that is, all processes call it and it can use collective operations; furthermore, the computed result must be the same in all processes.

The result of `func` is expressed as a complex number so that it is possible to use the standard eigenvalue sorting functions, but normally only `rr` is used. Set `ri` to zero unless it is meaningful in your application.

## See Also

EPS: Eigenvalue Problem Solver, `EPSSetWhichEigenpairs()`

## Level

advanced

## Location

src/eps/interface/epsopts.c

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