Skip to main content
`Ctrl`+`K`

# 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"
    PetscErrorCode MatFDColoringApply(Mat J, MatFDColoring coloring, Vec x1, void *sctx)

Collective

## Input Parameters

- J - location to store Jacobian

- coloring - coloring context created with `MatFDColoringCreate()`

- x1 - location at which Jacobian is to be computed

- sctx - context required by function, if this is being used with the SNES solver then it is `SNES` object, otherwise it is null

## Options Database Keys

- -mat_fd_type - “wp” or “ds” (see `MATMFFD_WP` or `MATMFFD_DS`)

- -mat_fd_coloring_view - Activates basic viewing or coloring

- -mat_fd_coloring_view draw - Activates drawing of coloring

- -mat_fd_coloring_view ::ascii_info - Activates viewing of coloring info

## See Also

`Mat`, `MatFDColoring`, `MatFDColoringCreate()`, `MatFDColoringDestroy()`, `MatFDColoringView()`, `MatFDColoringSetFunction()`, `MatFDColoringSetValues()`

## Level

intermediate

## Location

src/mat/matfd/fdmatrix.c

## Implementations

MatFDColoringApply_BAIJ() in src/mat/impls/aij/mpi/fdmpiaij.c
MatFDColoringApply_AIJ() in src/mat/impls/aij/mpi/fdmpiaij.c

Index of all MatFD routines
Table of Contents for all manual pages
Index of all manual pages