# MatMFFDComputeJacobian#

Tells the matrix-free Jacobian object the new location at which Jacobian matrix vector products will be computed at, i.e. J(x) * a. The x is obtained from the `SNES`

object (using `SNESGetSolution()`

).

## Synopsis#

```
#include "petscsnes.h"
#include "petscdm.h"
PetscErrorCode MatMFFDComputeJacobian(SNES snes, Vec x, Mat jac, Mat B, void *dummy)
```

Collective

## Input Parameters#

the nonlinear solver context**snes -**the point at which the Jacobian vector products will be performed**x -**the matrix-free Jacobian object of**jac -**`MatType`

`MATMFFD`

, likely obtained with`MatCreateSNESMF()`

either the same as jac or another matrix type (ignored)**B -**the user context (ignored)**dummy -**

## Options Database Key#

use the matrix created with**-snes_mf -**`MatSNESMFCreate()`

to setup the Jacobian for each new solution in the Newton process

## Notes#

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.

This can be passed into `SNESSetJacobian()`

as the Jacobian evaluation function argument
when using a completely matrix-free solver,
that is the B matrix is also the same matrix operator. This is used when you select
-snes_mf but rarely used directly by users. (All this routine does is call `MatAssemblyBegin/End()`

on
the `Mat`

jac.)

## See Also#

`MatMFFDGetH()`

, `MatCreateSNESMF()`

, `MatMFFDSetBase()`

, `MatCreateMFFD()`

, `MATMFFD`

,
`MatMFFDSetHHistory()`

, `MatMFFDSetFunctionError()`

, `SNESSetJacobian()`

## Level#

developer

## Location#

Index of all SNES routines

Table of Contents for all manual pages

Index of all manual pages