:orphan:
# MatGetRowIJ
Returns the compressed row storage i and j indices for the local rows of a sparse matrix 
## Synopsis
```
#include "petscmat.h" 
PetscErrorCode MatGetRowIJ(Mat mat, PetscInt shift, PetscBool symmetric, PetscBool inodecompressed, PetscInt *n, const PetscInt *ia[], const PetscInt *ja[], PetscBool *done)
```
Collective


## Input Parameters

- ***mat -*** the matrix
- ***shift -*** 0 or 1 indicating we want the indices starting at 0 or 1
- ***symmetric -*** `PETSC_TRUE` or `PETSC_FALSE` indicating the matrix data structure should be symmetrized
- ***inodecompressed -*** `PETSC_TRUE` or `PETSC_FALSE`  indicating if the nonzero structure of the
inodes or the nonzero elements is wanted. For `MATBAIJ` matrices the compressed version is
always used.



## Output Parameters

- ***n -*** number of local rows in the (possibly compressed) matrix, use `NULL` if not needed
- ***ia -*** the row pointers; that is ia[0] = 0, ia[row] = ia[row-1] + number of elements in that row of the matrix, use `NULL` if not needed
- ***ja -*** the column indices, use `NULL` if not needed
- ***done -*** indicates if the routine actually worked and returned appropriate ia[] and ja[] arrays; callers
are responsible for handling the case when done == `PETSC_FALSE` and ia and ja are not set





## Notes
You CANNOT change any of the ia[] or ja[] values.

Use `MatRestoreRowIJ()` when you are finished accessing the ia[] and ja[] values.


## Fortran Notes
Use
```none
    PetscInt, pointer :: ia(:),ja(:)
    call MatGetRowIJF90(mat,shift,symmetric,inodecompressed,n,ia,ja,done,ierr)
    ! Access the ith and jth entries via ia(i) and ja(j)
```

`MatGetRowIJ()` Fortran binding is deprecated (since PETSc 3.19), use `MatGetRowIJF90()`


## See Also
 [](ch_matrices), `Mat`, `MATAIJ`, `MatGetRowIJF90()`, `MatGetColumnIJ()`, `MatRestoreRowIJ()`, `MatSeqAIJGetArray()`

## Level
developer

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

## Implementations

<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/mat/impls/adj/mpi/mpiadj.c.html#MatGetRowIJ_MPIAdj">MatGetRowIJ_MPIAdj in src/mat/impls/adj/mpi/mpiadj.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/mat/impls/aij/mpi/mpiaij.c.html#MatGetRowIJ_MPIAIJ">MatGetRowIJ_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#MatGetRowIJ_SeqAIJ">MatGetRowIJ_SeqAIJ in src/mat/impls/aij/seq/aij.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/mat/impls/baij/seq/baij.c.html#MatGetRowIJ_SeqBAIJ">MatGetRowIJ_SeqBAIJ in src/mat/impls/baij/seq/baij.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/mat/impls/sbaij/seq/sbaij.c.html#MatGetRowIJ_SeqSBAIJ">MatGetRowIJ_SeqSBAIJ in src/mat/impls/sbaij/seq/sbaij.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](/manualpages/index.md)  
[Index of all manual pages](/manualpages/singleindex.md)  
