# NEPSetFunction

Sets the function to compute the nonlinear Function T(lambda) as well as the location to store the matrix.

### Synopsis

    #include "slepcnep.h"
    PetscErrorCode NEPSetFunction(NEP nep,Mat A,Mat B,PetscErrorCode (*fun)(NEP,PetscScalar,Mat*,Mat*,MatStructure*,void*),void *ctx)

Logically Collective on NEP and Mat

### Input Parameters

| nep | - the NEP context
| A | - Function matrix
| B | - preconditioner matrix (usually same as the Function)
| fun | - Function evaluation routine (if NULL then NEP retains any previously set value)
| ctx | - [optional] user-defined context for private data for the Function evaluation routine (may be NULL) (if NULL then NEP retains any previously set value)

### Notes

The routine fun() takes Mat* as the matrix arguments rather than Mat. This allows the Function evaluation routine to replace A and/or B with a completely new matrix structure (not just different matrix elements) when appropriate, for instance, if the nonzero structure is changing throughout the global iterations.

### See Also

NEPGetFunction(), NEPSetJacobian()

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

### Examples

src/nep/examples/tutorials/ex20.c.html
src/nep/examples/tutorials/ex21.c.html