# 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 PETSCMAT_DLLEXPORT MatDiagonalSet(Mat Y,Vec D,InsertMode is)

### Input Parameters

Collective on Mat and Vec

### Keywords

matrix, add, shift, diagonal

### See Also

MatShift()

**Level:**intermediate

Location:src/mat/utils/axpy.c

Index of all Mat routines

Table of Contents for all manual pages

Index of all manual pages