MatSetValue#

Set a single entry into a matrix.

Synopsis#

Not Collective

Input Parameters#

  • mat - the matrix

  • i - the row location of the entry

  • j - the column location of the entry

  • va - the value to insert

  • mode - either INSERT_VALUES or ADD_VALUES

Notes#

This value may be cached, so MatAssemblyBegin() and MatAssemblyEnd() MUST be called after all calls to MatSetValue() have been completed.

For efficiency one should use MatSetValues() and set several values simultaneously.

See Also#

Matrices, Mat, MatAssemblyBegin(), MatAssemblyEnd(), InsertMode, MatGetValue(), MatSetValues(), MatSetValueLocal(), MatSetValuesLocal()

Level#

beginner

Location#

include/petscmat.h

Examples#

src/ts/tutorials/ex10.c
src/ts/tutorials/ex24.c
src/ksp/ksp/tutorials/ex59.c
src/ksp/ksp/tutorials/ex61f.F90
src/ksp/ksp/tutorials/ex27.c
src/ksp/ksp/tutorials/ex73.c
src/ts/tutorials/ex20opt_p.c
src/ksp/ksp/tutorials/ex84.c
src/ts/tutorials/ex44.c
src/ts/tutorials/ex43.c


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