Skip to main content
`Ctrl`+`K`

# 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)

## Notes

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

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

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

Matrices, `Mat`, `MATSCALAPACK`, `MATDENSE`, `MATELEMENTAL`, `MatCreate()`, `MatCreateDense()`, `MatSetValues()`

## Level

intermediate

## Location

src/mat/impls/scalapack/matscalapack.c

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