MatGetLocalSize — PETSc 3.25.1 documentation

Skip to main content
`Ctrl`+`K`

# MatGetLocalSize

For most matrix formats, excluding `MATELEMENTAL` and `MATSCALAPACK`, Returns the number of local rows and local columns of a matrix. For all matrices this is the local size of the left and right vectors as returned by `MatCreateVecs()`.

## Synopsis

    #include "petscmat.h"
    PetscErrorCode MatGetLocalSize(Mat mat, PetscInt *m, PetscInt *n)

Not Collective

## Input Parameter

- mat - the matrix

## Output Parameters

- m - the number of local rows, use `NULL` to not obtain this value

- n - the number of local columns, use `NULL` to not obtain this value

## See Also

Matrices, `Mat`, `MatSetSizes()`, `MatGetSize()`

## Level

beginner

## Location

src/mat/interface/matrix.c

## Examples

src/ksp/ksp/tutorials/ex71.c
src/mat/tutorials/ex20f.F90
src/ksp/ksp/tutorials/ex87.c
src/ksp/ksp/tutorials/ex77f.F90
src/ksp/ksp/tutorials/ex27.c
src/ksp/ksp/tutorials/ex77.c
src/ksp/pc/tutorials/ex4.c
src/snes/tutorials/ex12.c
src/ksp/ksp/tutorials/ex10.c
src/ksp/ksp/tutorials/ex72.c

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