MatColoring — PETSc 3.24.5 documentation

Skip to main content
`Ctrl`+`K`

# MatColoring

Object for managing the coloring of matrices.

## Synopsis

    typedef struct _p_MatColoring *MatColoring;

## Notes

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 via `DMCreateColoring()`. In general using the mesh produces a more optimal coloring (fewer colors).

Once a coloring is available `MatFDColoringCreate()` creates an object that can be used to efficiently compute Jacobians using that coloring. This same object can also be used to efficiently convert data created by Automatic Differentiation tools to PETSc sparse matrices.

## See Also

Matrices, Graph Operations, `MatFDColoringCreate()`, `MatColoringWeightType`, `ISColoring`, `MatFDColoring`, `DMCreateColoring()`, `MatColoringCreate()`, `MatPartitioning`, `MatColoringType`, `MatPartitioningType`, `MatOrderingType`, `MatColoringSetWeightType()`, `MatColoringSetWeights()`, `MatCoarsenType`, `MatCoarsen`

## Level

beginner

## Location

include/petscmat.h

## Examples

src/mat/tutorials/ex16.c

## Implementations

_p_MatColoring in include/petsc/private/matimpl.h

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