# SNESComputeJacobian

Computes the Jacobian matrix that has been set with SNESSetJacobian().

### Synopsis

    #include "petscsnes.h"
    PetscErrorCode PETSCSNES_DLLEXPORT SNESComputeJacobian(SNES snes,Vec X,Mat *A,Mat *B,MatStructure *flg)

Collective on SNES and Mat

### Input Parameters

| snes | - the SNES context
| x | - input vector

### Output Parameters

| A | - Jacobian matrix
| B | - optional preconditioning matrix
| flag | - flag indicating matrix structure (one of, SAME_NONZERO_PATTERN,DIFFERENT_NONZERO_PATTERN,SAME_PRECONDITIONER)

### Notes

Most users should not need to explicitly call this routine, as it is used internally within the nonlinear solvers.

See KSPSetOperators() for important information about setting the flag parameter.

### Keywords

SNES, compute, Jacobian, matrix

### See Also

SNESSetJacobian(), KSPSetOperators(), MatStructure

Level:developer
Location:src/snes/interface/snes.c
Index of all SNES routines
Table of Contents for all manual pages
Index of all manual pages