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)
Neighbor-wise Collective
Input Parameters#
Y - the input matrix
D - the diagonal matrix, represented as a vector
is -
INSERT_VALUES
orADD_VALUES
Note#
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).
See Also#
Matrices, Mat
, MatShift()
, MatScale()
, MatDiagonalScale()
Level#
intermediate
Location#
Examples#
src/ksp/ksp/tutorials/ex21.c
src/tao/constrained/tutorials/tomographyADMM.c
src/ts/tutorials/ex50.c
src/tao/pde_constrained/tutorials/elliptic.c
src/tao/tutorials/ex4.c
src/tao/unconstrained/tutorials/burgers_spectral.c
Implementations#
MatDiagonalSet_MPIAIJ() in src/mat/impls/aij/mpi/mpiaij.c
MatDiagonalSet_SeqAIJ() in src/mat/impls/aij/seq/aij.c
MatDiagonalSet_Diagonal() in src/mat/impls/diagonal/diagonal.c
MatDiagonalSet_IS() in src/mat/impls/is/matis.c
MatDiagonalSet_Nest() in src/mat/impls/nest/matnest.c
MatDiagonalSet_MPISELL() in src/mat/impls/sell/mpi/mpisell.c
MatDiagonalSet_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