# MatCreateScaLAPACK
Creates a dense parallel matrix in ScaLAPACK format (2D block cyclic distribution) for a `MATSCALAPACK` matrix 
## Synopsis
```
#include "petscmat.h" 
PetscErrorCode MatCreateScaLAPACK(MPI_Comm comm, PetscInt mb, PetscInt nb, PetscInt M, PetscInt N, PetscInt rsrc, PetscInt csrc, Mat *A)
```
Collective


## Input Parameters

- ***comm -*** MPI communicator
- ***mb   -*** row block size (or `PETSC_DECIDE` to have it set)
- ***nb   -*** column block size (or `PETSC_DECIDE` to have it set)
- ***M    -*** number of global rows
- ***N    -*** number of global columns
- ***rsrc -*** coordinate of process that owns the first row of the distributed matrix
- ***csrc -*** coordinate of process that owns the first column of the distributed matrix



## Output Parameter

- ***A -*** the matrix



## Options Database Key

- ***-mat_scalapack_block_sizes -*** size of the blocks to use (one or two integers separated by comma)


It is recommended that one use the `MatCreate()`, `MatSetType()` and/or `MatSetFromOptions()`,
MatXXXXSetPreallocation() paradigm instead of this routine directly.
[MatXXXXSetPreallocation() is, for example, `MatSeqAIJSetPreallocation()`]


## Note
If `PETSC_DECIDE` is used for the block sizes, then an appropriate value
is chosen.


## Storage Information
Storate is completely managed by ScaLAPACK, so this requires PETSc to be
configured with ScaLAPACK. In particular, PETSc's local sizes lose
significance and are thus ignored. The block sizes refer to the values
used for the distributed matrix, not the same meaning as in `MATBAIJ`.




## See Also
 `MATSCALAPACK`, `MATDENSE`, `MATELEMENTAL`, `MatCreate()`, `MatCreateDense()`, `MatSetValues()`

## Level
intermediate

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/mat/impls/scalapack/matscalapack.c.html#MatCreateScaLAPACK">src/mat/impls/scalapack/matscalapack.c</A>


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