petsc-3.4.2 2013-07-02

# MatMFFDSetFunction

Sets the function used in applying the matrix free.

### Synopsis

    #include "petscmat.h"
    PetscErrorCode  MatMFFDSetFunction(Mat mat,PetscErrorCode (*func)(void*,Vec,Vec),void *funcctx)

Logically Collective on Mat

### Input Parameters

| mat | - the matrix free matrix created via MatCreateSNESMF()
| func | - the function to use
| funcctx | - optional function context passed to function

### Notes

If you use this you MUST call MatAssemblyBegin()/MatAssemblyEnd() on the matrix free matrix inside your compute Jacobian routine

If this is not set then it will use the function set with SNESSetFunction() if MatCreateSNESMF() was used.

### Keywords

SNES, matrix-free, function

### See Also

MatCreateSNESMF(),MatMFFDGetH(), MatCreateMFFD(), MATMFFD,
MatMFFDSetHHistory(), MatMFFDResetHHistory(), SNESetFunction()

Level:advanced
Location: src/mat/impls/mffd/mffd.c
Index of all Mat routines
Table of Contents for all manual pages
Index of all manual pages

### Examples

src/snes/examples/tutorials/ex22.c.html