:orphan:
# MatDenseGetArrayAndMemType
gives read-write access to the array where the data for a `MATDENSE` matrix is stored 
## Synopsis
```
#include "petscmat.h" 
PetscErrorCode MatDenseGetArrayAndMemType(Mat A, PetscScalar **array, PetscMemType *mtype)
```
Logically Collective


## Input Parameter

- ***mat -*** a dense matrix



## Output Parameters

- ***array -*** pointer to the data
- ***mtype -*** memory type of the returned pointer





## Notes
If the matrix is of a device type such as `MATDENSECUDA`, `MATDENSEHIP`, etc.,
an array on device is always returned and is guaranteed to contain the matrix's latest data.


## See Also
 [](ch_matrices), `Mat`, `MATDENSE`, `MatDenseRestoreArrayAndMemType()`, `MatDenseGetArrayReadAndMemType()`, `MatDenseGetArrayWriteAndMemType()`, `MatDenseGetArrayRead()`,
`MatDenseRestoreArrayRead()`, `MatDenseGetArrayWrite()`, `MatDenseRestoreArrayWrite()`, `MatSeqAIJGetCSRAndMemType()`

## Level
intermediate

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


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