petsc-3.14.5 2021-03-03
Report Typos and Errors

# MatColoringCreate

Creates a matrix coloring context.

### Synopsis

    #include "petscmat.h"
    PetscErrorCode MatColoringCreate(Mat m,MatColoring *mcptr)

Collective on MatColoring

### Input Parameters

| comm | - MPI communicator

### Output Parameter

| mcptr | - the new MatColoring context

### Options Database Keys

| -mat_coloring_type | - the type of coloring algorithm used
| -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
| -mat_coloring_test | - debugging option that prints all coloring incompatibilities
| -mat_is_coloring_test | - debugging option that throws an error if MatColoringApply() generates an incorrect iscoloring

### Notes

A distance one coloring is useful, for example, multi-color SOR. A distance two coloring is for the finite difference computation of Jacobians (see MatFDColoringCreate()).

Coloring of matrices can be computed directly from the sparse matrix nonzero structure via the MatColoring object or from the mesh from which the matrix comes from with DMCreateColoring(). In general using the mesh produces a more optimal coloring (fewer colors).

Some coloring types only support distance two colorings

### See Also

MatColoring, MatColoringApply(), MatFDColoringCreate(), DMCreateColoring()

### Level

beginner

### Location

src/mat/color/interface/matcoloring.c

### Examples

src/mat/tutorials/ex16.c.html

### Implementations

MatColoringCreate_Greedy in src/mat/color/impls/greedy/greedy.c
MatColoringCreate_JP in src/mat/color/impls/jp/jp.c
MatColoringCreate_SL in src/mat/color/impls/minpack/color.c
MatColoringCreate_LF in src/mat/color/impls/minpack/color.c
MatColoringCreate_ID in src/mat/color/impls/minpack/color.c
MatColoringCreate_Natural in src/mat/color/impls/natural/natural.c
MatColoringCreate_Power in src/mat/color/impls/power/power.c
Index of all MatOrderings routines
Table of Contents for all manual pages
Index of all manual pages