:orphan:
# SNESGetJacobian
Returns the Jacobian matrix and optionally the user provided context for evaluating the Jacobian.
## Synopsis
```
#include "petscsnes.h"
PetscErrorCode SNESGetJacobian(SNES snes, Mat *Amat, Mat *Pmat, PetscErrorCode (**J)(SNES, Vec, Mat, Mat, void *), void **ctx)
```
Not Collective, but `Mat` object will be parallel if `SNES` object is
## Input Parameter
- ***snes -*** the nonlinear solver context
## Output Parameters
- ***Amat -*** location to stash (approximate) Jacobian matrix (or `NULL`)
- ***Pmat -*** location to stash matrix used to compute the preconditioner (or `NULL`)
- ***J -*** location to put Jacobian function (or `NULL`), for calling sequence see `SNESJacobianFunction`
- ***ctx -*** location to stash Jacobian ctx (or `NULL`)
## See Also
[](ch_snes), `SNES`, `Mat`, `SNESSetJacobian()`, `SNESComputeJacobian()`, `SNESJacobianFunction`, `SNESGetFunction()`
## Level
advanced
## Location
src/snes/interface/snes.c
## Examples
src/snes/tutorials/ex62.c
src/snes/tutorials/ex69.c
---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/snes/interface/snes.c)
[Index of all SNES routines](index.md)
[Table of Contents for all manual pages](/manualpages/index.md)
[Index of all manual pages](/manualpages/singleindex.md)