:orphan:
# MatMPIDenseSetPreallocation
Sets the array used to store the matrix entries
## Synopsis
```
#include "petscmat.h"
PetscErrorCode MatMPIDenseSetPreallocation(Mat B, PetscScalar *data)
```
Collective
## Input Parameters
- ***B -*** the matrix
- ***data -*** optional location of matrix data. Set to `NULL` for PETSc
to control all matrix memory allocation.
## Notes
The dense format is fully compatible with standard Fortran
storage by columns.
The data input variable is intended primarily for Fortran programmers
who wish to allocate their own matrix memory space. Most users should
set `data` to `NULL`.
## See Also
[](ch_matrices), `Mat`, `MATMPIDENSE`, `MatCreate()`, `MatCreateSeqDense()`, `MatSetValues()`
## Level
intermediate
## Location
src/mat/impls/dense/mpi/mpidense.c
## Implementations
MatMPIDenseSetPreallocation_MPIDense in src/mat/impls/dense/mpi/mpidense.c
---
[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)