MatCreateDiagonal#

Creates a matrix defined by a given vector along its diagonal.

Synopsis#

#include "petscmat.h" 
PetscErrorCode MatCreateDiagonal(Vec diag, Mat *J)

Collective

Input Parameter#

  • diag - vector for the diagonal

Output Parameter#

  • J - the diagonal matrix

Notes#

Only supports square matrices with the same number of local rows and columns.

The input vector diag will be referenced internally: any changes to diag will affect the matrix J.

See Also#

Matrices, Mat, MatDestroy(), MATCONSTANTDIAGONAL, MatScale(), MatShift(), MatMult(), MatGetDiagonal(), MatSolve() MatDiagonalRestoreInverseDiagonal(), MatDiagonalGetDiagonal(), MatDiagonalRestoreDiagonal(), MatDiagonalGetInverseDiagonal()

Level#

advanced

Location#

src/mat/impls/diagonal/diagonal.c


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