# MatFDColoringApply

Given a matrix for which a MatFDColoring context has been created, computes the Jacobian for a function via finite differences.

### Synopsis

    #include "petscmat.h"
    #include "petscda.h"
    PetscErrorCode PETSCMAT_DLLEXPORT MatFDColoringApply(Mat J,MatFDColoring coloring,Vec x1,MatStructure *flag,void *sctx)

Collective on MatFDColoring

### Input Parameters

| mat | - location to store Jacobian
| coloring | - coloring context created with MatFDColoringCreate()
| x1 | - location at which Jacobian is to be computed
| sctx | - optional context required by function (actually a SNES context)

### Options Database Keys

| -mat_fd_coloring_freq <freq> | - Sets coloring frequency
| -mat_fd_type | - "wp" or "ds" (see MATSNESMF_WP or MATSNESMF_DS)
| -mat_fd_coloring_view | - Activates basic viewing or coloring
| -mat_fd_coloring_view_draw | - Activates drawing of coloring
| -mat_fd_coloring_view_info | - Activates viewing of coloring info

### See Also

MatFDColoringCreate(), MatFDColoringDestroy(), MatFDColoringView()

### Keywords

coloring, Jacobian, finite differences

Level:intermediate
Location: src/mat/matfd/fdmatrix.c
Index of all MatFD routines
Table of Contents for all manual pages
Index of all manual pages

### Examples

src/snes/examples/tutorials/ex5.c.html