# MatSeqAIJGetCSRAndMemType
Get the CSR arrays and the memory type of the `MATSEQAIJ` matrix 
## Synopsis
```
#include "petscmat.h" 
PetscErrorCode MatSeqAIJGetCSRAndMemType(Mat mat, const PetscInt **i, const PetscInt **j, PetscScalar **a, PetscMemType *mtype)
```
Not Collective


## Input Parameter

- ***mat -*** a matrix of type `MATSEQAIJ` or its subclasses



## Output Parameters

- ***i -*** row map array of the matrix
- ***j -*** column index array of the matrix
- ***a -*** data array of the matrix
- ***memtype -*** memory type of the arrays



## Notes
Any of the output parameters can be NULL, in which case the corresponding value is not returned.
If mat is a device matrix, the arrays are on the device. Otherwise, they are on the host.

One can call this routine on a preallocated but not assembled matrix to just get the memory of the CSR underneath the matrix.
If the matrix is assembled, the data array 'a' is guaranteed to have the latest values of the matrix.




## See Also
 `MatSeqAIJGetArray()`, `MatSeqAIJGetArrayRead()`

## Level
Developer

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/mat/impls/aij/seq/aij.c.html#MatSeqAIJGetCSRAndMemType">src/mat/impls/aij/seq/aij.c</A>

## Implementations

<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/mat/impls/aij/seq/kokkos/aijkok.kokkos.cxx.html#MatSeqAIJGetCSRAndMemType_SeqAIJKokkos">MatSeqAIJGetCSRAndMemType_SeqAIJKokkos in src/mat/impls/aij/seq/kokkos/aijkok.kokkos.cxx</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/mat/impls/aij/seq/seqcusparse/aijcusparse.cu.html#MatSeqAIJGetCSRAndMemType_SeqAIJCUSPARSE">MatSeqAIJGetCSRAndMemType_SeqAIJCUSPARSE in src/mat/impls/aij/seq/seqcusparse/aijcusparse.cu</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/mat/impls/aij/seq/seqhipsparse/aijhipsparse.hip.c.html#MatSeqAIJGetCSRAndMemType_SeqAIJHIPSPARSE">MatSeqAIJGetCSRAndMemType_SeqAIJHIPSPARSE in src/mat/impls/aij/seq/seqhipsparse/aijhipsparse.hip.c</A><BR>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/mat/impls/aij/seq/aij.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)  
