# MatPartitioningApply
Gets a partitioning for the graph represented by a sparse matrix. 
## Synopsis
```
#include "petscmat.h" 
PetscErrorCode MatPartitioningApply(MatPartitioning matp, IS *partitioning)
```
Collective on matp


## Input Parameters

- ***matp -*** the matrix partitioning object



## Output Parameters

- ***partitioning -*** the partitioning. For each local node this tells the processor
number that that node is assigned to.



## Options Database Keys
To specify the partitioning through the options database, use one of
the following
```none
-mat_partitioning_type parmetis, -mat_partitioning current
```
To see the partitioning result
```none
-mat_partitioning_view
```



The user can define additional partitionings; see `MatPartitioningRegister()`.


## See Also
 `MatPartitioning`, `MatPartitioningType`, `MatPartitioningRegister()`, `MatPartitioningCreate()`,
`MatPartitioningDestroy()`, `MatPartitioningSetAdjacency()`, `ISPartitioningToNumbering()`,
`ISPartitioningCount()`

## Level
beginner

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/mat/partition/partition.c.html#MatPartitioningApply">src/mat/partition/partition.c</A>

## Examples
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/mat/tutorials/ex11.c.html">src/mat/tutorials/ex11.c.html</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/mat/tutorials/ex15.c.html">src/mat/tutorials/ex15.c.html</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/mat/tutorials/ex15f.F90.html">src/mat/tutorials/ex15f.F90.html</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/mat/tutorials/ex17.c.html">src/mat/tutorials/ex17.c.html</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/mat/tutorials/ex17f.F90.html">src/mat/tutorials/ex17f.F90.html</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ksp/ksp/tutorials/ex64.c.html">src/ksp/ksp/tutorials/ex64.c.html</A><BR>

## Implementations

<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/mat/partition/impls/chaco/chaco.c.html#MatPartitioningApply_Chaco">MatPartitioningApply_Chaco in src/mat/partition/impls/chaco/chaco.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/mat/partition/impls/hierarchical/hierarchical.c.html#MatPartitioningApply_Hierarchical">MatPartitioningApply_Hierarchical in src/mat/partition/impls/hierarchical/hierarchical.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/mat/partition/impls/party/party.c.html#MatPartitioningApply_Party">MatPartitioningApply_Party in src/mat/partition/impls/party/party.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/mat/partition/impls/pmetis/pmetis.c.html#MatPartitioningApply_Parmetis">MatPartitioningApply_Parmetis in src/mat/partition/impls/pmetis/pmetis.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/mat/partition/impls/scotch/scotch.c.html#MatPartitioningApply_PTScotch">MatPartitioningApply_PTScotch in src/mat/partition/impls/scotch/scotch.c</A><BR>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/mat/partition/partition.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)  
