Skip to main content
`Ctrl`+`K`

# 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

- A - a dense matrix

## Output Parameters

- array - pointer to the data

- mtype - memory type of the returned pointer

## Note

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

Matrices, `Mat`, `MATDENSE`, `MatDenseRestoreArrayAndMemType()`, `MatDenseGetArrayReadAndMemType()`, `MatDenseGetArrayWriteAndMemType()`, `MatDenseGetArrayRead()`, `MatDenseRestoreArrayRead()`, `MatDenseGetArrayWrite()`, `MatDenseRestoreArrayWrite()`, `MatSeqAIJGetCSRAndMemType()`

## Level

intermediate

## Location

src/mat/impls/dense/seq/dense.c

Index of all Mat routines
Table of Contents for all manual pages
Index of all manual pages