petsc-3.7.1 2016-05-15
Report Typos and Errors

# SNESComputeJacobian

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

### Synopsis

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

Collective on SNES and Mat Many br

### Input Parameters

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

### Output Parameters

| A | - Jacobian matrix Many br
| B | - optional preconditioning matrix Many br

### Options Database Keys

| -snes_lag_preconditioner <lag> | - . -snes_lag_jacobian <lag> Many br
| -snes_compare_explicit | - Compare the computed Jacobian to the finite difference Jacobian and output the differences Many br
| -snes_compare_explicit_draw | - Compare the computed Jacobian to the finite difference Jacobian and draw the result Many br
| -snes_compare_explicit_contour | - Compare the computed Jacobian to the finite difference Jacobian and draw a contour plot with the result Many br
| -snes_compare_operator | - Make the comparison options above use the operator instead of the preconditioning matrix Many br
| -snes_compare_coloring | - Compute the finite difference Jacobian using coloring and display norms of difference Many br
| -snes_compare_coloring_display | - Compute the finite differece Jacobian using coloring and display verbose differences Many br
| -snes_compare_coloring_threshold | - Display only those matrix entries that differ by more than a given threshold Many br
| -snes_compare_coloring_threshold_atol | - Absolute tolerance for difference in matrix entries to be displayed by -snes_compare_coloring_threshold Many br
| -snes_compare_coloring_threshold_rtol | - Relative tolerance for difference in matrix entries to be displayed by -snes_compare_coloring_threshold Many br
| -snes_compare_coloring_draw | - Compute the finite differece Jacobian using coloring and draw differences Many br
| -snes_compare_coloring_draw_contour | - Compute the finite differece Jacobian using coloring and show contours of matrices and differences Many br

### Notes

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

Many br

### Keywords

SNES, compute, Jacobian, matrix

### See Also

SNESSetJacobian(), KSPSetOperators(), MatStructure, SNESSetLagPreconditioner(), SNESSetLagJacobian()

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

### Examples

src/snes/examples/tutorials/ex12.c.html
src/snes/examples/tutorials/ex62.c.html
src/snes/examples/tutorials/ex77.c.html