MatSetValue

Set a single entry into a matrix.

Synopsis

int MatSetValue(Mat m,int row,int col,PetscScalar value,InsertMode mode);
Not collective

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.

Note that VecSetValue() does NOT return an error code (since this is checked internally).

See Also

MatSetValues()

Level:beginner
Location:
src/mat/interface/matrix.c
Index of all Mat routines
Table of Contents for all manual pages
Index of all manual pages

Examples

src/snes/examples/tutorials/ex26.c.html