# MatCreateSNESMF

Creates a matrix-free matrix context for use with a SNES solver. This matrix can be used as the Jacobian argument for the routine SNESSetJacobian(). See MatCreateMFFD() for details on how the finite difference computation is done.

### Synopsis

    #include "petscsnes.h"
    PetscErrorCode PETSCSNES_DLLEXPORT MatCreateSNESMF(SNES snes,Mat *J)

Collective on SNES and Vec

### Input Parameters

snes -the SNES context

### Output Parameter

J -the matrix-free matrix

### Warning

If MatMFFDSetBase() is ever called on jac then this routine will NO longer get the x from the SNES object and MatMFFDSetBase() must from that point on be used to change the base vector x.

Notes: The difference between this routine and MatCreateMFFD() is that this matrix automatically gets the current base vector from the SNES object and not from an explicit call to MatMFFDSetBase().

### See Also

MatDestroy(), MatMFFDSetFunctionError(), MatMFFDDefaultSetUmin()
MatMFFDSetHHistory(), MatMFFDResetHHistory(), MatCreateMFFD(), MatMFFDGetH(),MatMFFDKSPMonitor(), MatMFFDRegisterDynamic), MatMFFDComputeJacobian()

Level:advanced
Location: src/snes/mf/snesmfj.c
Index of all Mat routines
Table of Contents for all manual pages
Index of all manual pages