MatDiagonalGetDiagonal#

Get the diagonal of a MATDIAGONAL

Synopsis#

#include "petscmat.h" 
PetscErrorCode MatDiagonalGetDiagonal(Mat A, Vec *diag)

Input Parameter#

Output Parameter#

  • diag - the Vec that defines the diagonal

Note#

The user must call MatDiagonalRestoreDiagonal() before using the matrix again.

For a copy of the diagonal values, rather than a reference, use MatGetDiagonal()

Any changes to the obtained vector immediately change the action of the Mat. The matrix can be changed more efficiently by accessing this vector and changing its values, instead of filling a work vector and using MatDiagonalSet()

See Also#

Matrices, MATDIAGONAL, MatCreateDiagonal(), MatDiagonalRestoreDiagonal(), MatDiagonalGetInverseDiagonal(), MatGetDiagonal()

Level#

developer

Location#

src/mat/impls/diagonal/diagonal.c

Implementations#

MatDiagonalGetDiagonal_Diagonal() in src/mat/impls/diagonal/diagonal.c


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