# MatGetRowMax
Gets the maximum value (of the real part) of each row of the matrix 
## Synopsis
```
#include "petscmat.h" 
PetscErrorCode MatGetRowMax(Mat mat, Vec v, PetscInt idx[])
```
Logically Collective


## Input Parameter

- ***mat -*** the matrix



## Output Parameters

- ***v -*** the vector for storing the maximums
- ***idx -*** the indices of the column found for each row (optional)





## Notes
The result of this call are the same as if one converted the matrix to dense format
and found the minimum value in each row (i.e. the implicit zeros are counted as zeros).

This code is only implemented for a couple of matrix formats.


## See Also
 `MatGetDiagonal()`, `MatCreateSubMatrices()`, `MatCreateSubMatrix()`, `MatGetRowMaxAbs()`, `MatGetRowMin()`, `MatGetRowMinAbs()`

## Level
intermediate

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

## Implementations

<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/mat/impls/aij/mpi/mpiaij.c.html#MatGetRowMax_MPIAIJ">MatGetRowMax_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#MatGetRowMax_SeqAIJ">MatGetRowMax_SeqAIJ in src/mat/impls/aij/seq/aij.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/mat/impls/dense/seq/dense.c.html#MatGetRowMax_SeqDense">MatGetRowMax_SeqDense in src/mat/impls/dense/seq/dense.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)  
