MatDiagonalSet
Computes Y = Y + D, where D is a diagonal matrix that is represented as a vector. Or Y[i,i] = D[i] if InsertMode is INSERT_VALUES.
Synopsis
#include "petscmat.h"
PetscErrorCode MatDiagonalSet(Mat Y,Vec D,InsertMode is)
Input Parameters
 Y   the input matrix

 D   the diagonal matrix, represented as a vector

 i   INSERT_VALUES or ADD_VALUES

Neighborwise Collective on Mat
Notes
If the matrix Y is missing some diagonal entries this routine can be very slow. To make it fast one should initially
fill the matrix so that all diagonal entries have a value (with a value of zero for those locations that would not have an
entry).
Level: intermediate
See Also
MatShift(), MatScale(), MatDiagonalScale()
Location:axpy.c