# 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 Differentation tools to PETSc sparse matrices.


## See Also
 `MatFDColoringCreate()`, `MatColoringWeightType`, `ISColoring`, `MatFDColoring`, `DMCreateColoring()`, `MatColoringCreate()`, `MatOrdering`, `MatPartitioning`, `MatColoringType`

## Level
beginner

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/include/petscmat.h.html#MatColoring">include/petscmat.h</A>

## Implementations

<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/include/petsc/private/matimpl.h.html#_p_MatColoring">_p_MatColoring in include/petsc/private/matimpl.h</A><BR>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/include/petscmat.h)


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