# MatMFFDSetFunctioni
Sets the function for a single component for a `MATMFFD` matrix 
## Synopsis
```
#include "petscmat.h"   
PetscErrorCode MatMFFDSetFunctioni(Mat mat, PetscErrorCode (*funci)(void *, PetscInt, Vec, PetscScalar *))
```
Logically Collective on mat


## Input Parameters

- ***mat -*** the matrix free matrix `MATMFFD`
- ***funci -*** the function to use





## Notes
If you use this you MUST call `MatAssemblyBegin()` and `MatAssemblyEnd()` on the matrix free
matrix inside your compute Jacobian routine.

This function is necessary to compute the diagonal of the matrix.
funci must not contain any MPI call as it is called inside a loop on the local portion of the vector.


## See Also
 `MATMFFD`, `MatCreateSNESMF()`, `MatMFFDGetH()`, `MatMFFDSetHHistory()`, `MatMFFDResetHHistory()`, `SNESetFunction()`, `MatGetDiagonal()`

## Level
advanced

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/mat/impls/mffd/mffd.c.html#MatMFFDSetFunctioni">src/mat/impls/mffd/mffd.c</A>

## Implementations

<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/mat/impls/mffd/mffd.c.html#MatMFFDSetFunctioni_MFFD">MatMFFDSetFunctioni_MFFD in src/mat/impls/mffd/mffd.c</A><BR>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/mat/impls/mffd/mffd.c)


[Index of all Mat routines](index.md)  
[Table of Contents for all manual pages](/docs/manualpages/index.md)  
[Index of all manual pages](/docs/manualpages/singleindex.md)  
