:orphan:
# MatGetRowSum
Gets the sum of each row of the matrix 
## Synopsis
```
#include "petscmat.h" 
PetscErrorCode MatGetRowSum(Mat mat, Vec v)
```
Logically or Neighborhood Collective


## Input Parameter

- ***mat -*** the matrix



## Output Parameter

- ***v -*** the vector for storing the sum of rows





## Notes
This code is slow since it is not currently specialized for different formats


## See Also
 [](ch_matrices), `Mat`, `MatGetDiagonal()`, `MatCreateSubMatrices()`, `MatCreateSubMatrix()`, `MatGetRowMax()`, `MatGetRowMin()`, `MatGetRowMaxAbs()`, `MatGetRowMinAbs()`

## Level
intermediate

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/mat/interface/matrix.c.html#MatGetRowSum">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)  
