petsc-3.13.6 2020-09-29
Report Typos and Errors

MatSetValue

Set a single entry into a matrix. Not collective

Synopsis

#include <petscmat.h>
PetscErrorCode MatSetValue(Mat m,PetscInt row,PetscInt col,PetscScalar value,InsertMode mode)

Input Parameters

m - the matrix
row - the row location of the entry
col - the column location of the entry
value - the value to insert
mode - either INSERT_VALUES or ADD_VALUES

Notes

For efficiency one should use MatSetValues() and set several or many values simultaneously if possible.

See Also

MatSetValues(), MatSetValueLocal()

Level

beginner

Location

src/mat/../../include/petscmat.h

Examples

src/mat/tutorials/ex4.c.html
src/mat/tutorials/ex4f.F90.html
src/ksp/ksp/tutorials/ex4.c.html
src/ksp/ksp/tutorials/ex59.c.html
src/ksp/ksp/tutorials/ex73.c.html
src/ksp/ksp/tutorials/ex44f.F90.html
src/ksp/ksp/tutorials/ex61f.F90.html
src/snes/tutorials/ex48.c.html
src/snes/tutorials/ex47cu.cu.html
src/ts/tutorials/ex10.c.html
src/ts/tutorials/ex24.c.html

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