:orphan:
# MatFindNonzeroRows
Locate all rows that are not completely zero in the matrix
## Synopsis
```
#include "petscmat.h"
PetscErrorCode MatFindNonzeroRows(Mat mat, IS *keptrows)
```
## Input Parameter
- ***A -*** the matrix
## Output Parameter
- ***keptrows -*** the rows that are not completely zero
## Note
`keptrows` is set to `NULL` if all rows are nonzero.
## See Also
[](ch_matrices), `Mat`, `MatFindZeroRows()`
## Level
intermediate
## Location
src/mat/interface/matrix.c
## Implementations
MatFindNonzeroRows_MPIAIJ in src/mat/impls/aij/mpi/mpiaij.c
MatFindNonzeroRows_SeqAIJ in src/mat/impls/aij/seq/aij.c
---
[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)