Skip to main content
`Ctrl`+`K`

# MatGetDiagonalBlock

Returns the part of the matrix associated with the on-process coupling

## Synopsis

    #include "petscmat.h"
    PetscErrorCode MatGetDiagonalBlock(Mat A, Mat *a)

Not Collective

## Input Parameter

- A - the matrix

## Output Parameter

- a - the diagonal part (which is a SEQUENTIAL matrix)

## Notes

See `MatCreateAIJ()` for more information on the “diagonal part” of the matrix.

Use caution, as the reference count on the returned matrix is not incremented and it is used as part of `A`’s normal operation.

## See Also

Matrices, `Mat`, `MatCreateAIJ()`, `MATAIJ`, `MATBAIJ`, `MATSBAIJ`

## Level

advanced

## Location

src/mat/interface/matrix.c

## Examples

src/ksp/ksp/tutorials/ex76f.F90
src/ksp/ksp/tutorials/ex76.c
src/ksp/ksp/tutorials/ex87.c

## Implementations

MatGetDiagonalBlock_MPIAIJ() in src/mat/impls/aij/mpi/mpiaijpc.c
MatGetDiagonalBlock_MPIBAIJ() in src/mat/impls/baij/mpi/mpibaij.c
MatGetDiagonalBlock_MPIDense() in src/mat/impls/dense/mpi/mpidense.c
MatGetDiagonalBlock_Htool() in src/mat/impls/htool/htool.cxx
MatGetDiagonalBlock_IS() in src/mat/impls/is/matis.c
MatGetDiagonalBlock_MPIKAIJ() in src/mat/impls/kaij/kaij.c
MatGetDiagonalBlock_Normal() in src/mat/impls/normal/normm.c
MatGetDiagonalBlock_NormalHermitian() in src/mat/impls/normal/normmh.c
MatGetDiagonalBlock_MPISBAIJ() in src/mat/impls/sbaij/mpi/mpisbaij.c
MatGetDiagonalBlock_MPISELL() in src/mat/impls/sell/mpi/mpisell.c
MatGetDiagonalBlock_Shell() in src/mat/impls/shell/shell.c

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