:orphan:
# MatDensePlaceArray
Allows one to replace the array in a `MATDENSE` matrix with an array provided by the user. This is useful to avoid copying an array into a matrix 
## Synopsis
```
#include "petscmat.h"  
PetscErrorCode MatDensePlaceArray(Mat mat, const PetscScalar *array)
```
Not Collective


## Input Parameters

- ***mat -*** the matrix
- ***array -*** the array in column major order





## Note
You can return to the original array with a call to `MatDenseResetArray()`. The user is responsible for freeing this array; it will not be
freed when the matrix is destroyed.


## See Also
 [](ch_matrices), `Mat`, `MATDENSE`, `MatDenseGetArray()`, `MatDenseResetArray()`, `VecPlaceArray()`, `VecGetArray()`, `VecRestoreArray()`, `VecReplaceArray()`, `VecResetArray()`,
`MatDenseReplaceArray()`

## Level
developer

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/mat/impls/dense/mpi/mpidense.c.html#MatDensePlaceArray">src/mat/impls/dense/mpi/mpidense.c</A>

## Implementations

<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/mat/impls/dense/mpi/mpidense.c.html#MatDensePlaceArray_MPIDense">MatDensePlaceArray_MPIDense in src/mat/impls/dense/mpi/mpidense.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/mat/impls/dense/seq/dense.c.html#MatDensePlaceArray_SeqDense">MatDensePlaceArray_SeqDense in src/mat/impls/dense/seq/dense.c</A><BR>


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