# 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
 `Mat`, `MatFindZeroRows()`

## Level
intermediate

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

## Implementations

<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/mat/impls/aij/mpi/mpiaij.c.html#MatFindNonzeroRows_MPIAIJ">MatFindNonzeroRows_MPIAIJ in src/mat/impls/aij/mpi/mpiaij.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/mat/impls/aij/seq/aij.c.html#MatFindNonzeroRows_SeqAIJ">MatFindNonzeroRows_SeqAIJ in src/mat/impls/aij/seq/aij.c</A><BR>


---
[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](/docs/manualpages/index.md)  
[Index of all manual pages](/docs/manualpages/singleindex.md)  
