:orphan:
# MatGetOwnershipRanges
For matrices that own values by row, excludes `MATELEMENTAL` and `MATSCALAPACK`, returns the range of matrix rows owned by each process. For all matrices  it returns the ranges of matrix rows associated with rows of a vector that would contain the result of a matrix vector product with this matrix. See [Matrix Layouts](sec_matlayout) for details on matrix layouts 
## Synopsis
```
#include "petscmat.h" 
PetscErrorCode MatGetOwnershipRanges(Mat mat, const PetscInt **ranges)
```
Not Collective, unless matrix has not been allocated


## Input Parameter

- ***mat -*** the matrix



## Output Parameter

- ***ranges -*** start of each processors portion plus one more than the total length at the end





## See Also
 [](ch_matrices), `Mat`, `MatGetOwnershipRange()`, `MatGetOwnershipRangeColumn()`, `MatGetOwnershipRangesColumn()`, `PetscLayout`

## Level
beginner

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/mat/interface/matrix.c.html#MatGetOwnershipRanges">src/mat/interface/matrix.c</A>


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


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