# MatGetSize

Returns the numbers of rows and columns in a matrix.

### Synopsis

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

Not Collective

### Input Parameter

mat -the matrix

### Output Parameters

| m | - the number of global rows
| n | - the number of global columns

Note: both output parameters can be PETSC_NULL on input.

### See Also

MatGetLocalSize()

Level:beginner
Location: src/mat/interface/matrix.c
Index of all Mat routines
Table of Contents for all manual pages
Index of all manual pages

### Examples

src/mat/examples/tutorials/ex4.c.html
src/ksp/ksp/examples/tutorials/ex10.c.html
src/snes/examples/tutorials/ex33f.F.html