# MatColoringSetFromOptions
Sets `MatColoring` options from options database 
## Synopsis
```
#include "petscmat.h"  
PetscErrorCode MatColoringSetFromOptions(MatColoring mc)
```
Collective


## Input Parameter

- ***mc -*** `MatColoring` context



## Options Database Keys

- ***-mat_coloring_type -*** the type of coloring algorithm used. See `MatColoringType`.
- ***-mat_coloring_maxcolors -*** the maximum number of relevant colors, all nodes not in a color are in maxcolors+1
- ***-mat_coloring_distance -*** compute a distance 1,2,... coloring.
- ***-mat_coloring_view -*** print information about the coloring and the produced index sets
- ***-snes_fd_color -*** instruct SNES to using coloring and then `MatFDColoring` to compute the Jacobians
- ***-snes_fd_color_use_mat -*** instruct `SNES` to color the matrix directly instead of the `DM` from which the matrix comes (the default)





## See Also
 `MatColoring`, `MatColoringApply()`, `MatColoringSetDistance()`, `MatColoringSetType()`, `SNESComputeJacobianDefaultColor()`, `MatColoringType`

## Level
beginner

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/mat/color/interface/matcoloring.c.html#MatColoringSetFromOptions">src/mat/color/interface/matcoloring.c</A>

## Examples
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/mat/tutorials/ex16.c.html">src/mat/tutorials/ex16.c.html</A><BR>

## Implementations

<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/mat/color/impls/greedy/greedy.c.html#MatColoringSetFromOptions_Greedy">MatColoringSetFromOptions_Greedy in src/mat/color/impls/greedy/greedy.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/mat/color/impls/jp/jp.c.html#MatColoringSetFromOptions_JP">MatColoringSetFromOptions_JP in src/mat/color/impls/jp/jp.c</A><BR>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/mat/color/interface/matcoloring.c)


[Index of all MatOrderings routines](index.md)  
[Table of Contents for all manual pages](/docs/manualpages/index.md)  
[Index of all manual pages](/docs/manualpages/singleindex.md)  
