Skip to main content
`Ctrl`+`K`

# MatSetValuesBlockedLocal

Inserts or adds values into certain locations of a matrix, using a local ordering of the nodes a block at a time.

## Synopsis

    #include "petscmat.h"
    PetscErrorCode MatSetValuesBlockedLocal(Mat mat, PetscInt nrow, const PetscInt irow[], PetscInt ncol, const PetscInt icol[], const PetscScalar y[], InsertMode addv)

Not Collective

## Input Parameters

- mat - the matrix

- nrow - number of rows

- irow - the row local indices

- ncol - number of columns

- icol - the column local indices

- y - a one-dimensional array that contains the values implicitly stored as a two-dimensional array, by default in row-major order. See `MAT_ROW_ORIENTED` in `MatSetOption()` for how to use column-major order.

- addv - either `ADD_VALUES` to add values to any existing entries, or `INSERT_VALUES` to replace existing entries with new values

## Notes

If you create the matrix yourself (that is not with a call to `DMCreateMatrix()`) then you MUST call `MatSetBlockSize()` and `MatSetLocalToGlobalMapping()` before using this routineBefore calling `MatSetValuesLocal()`, the user must first set the

Calls to `MatSetValuesBlockedLocal()` with the `INSERT_VALUES` and `ADD_VALUES` options cannot be mixed without intervening calls to the assembly routines.

These values may be cached, so `MatAssemblyBegin()` and `MatAssemblyEnd()` MUST be called after all calls to `MatSetValuesBlockedLocal()` have been completed.

## Fortran Notes

If any of `irow`, `icol`, and `y` are scalars pass them using, for example,

      call MatSetValuesBlockedLocal(mat, one, [irow], one, [icol], [y], INSERT_VALUES, ierr)

If `y` is a two-dimensional array use `reshape()` to pass it as a one dimensional array

## See Also

Matrices, `Mat`, `MatSetBlockSize()`, `MatSetLocalToGlobalMapping()`, `MatAssemblyBegin()`, `MatAssemblyEnd()`, `MatSetValuesLocal()`, `MatSetValuesBlocked()`

## Level

intermediate

## Location

src/mat/interface/matrix.c

## Examples

src/ts/tutorials/ex22f.F90
src/ts/tutorials/ex22f_mf.F90
src/ts/tutorials/ex14.c
src/ksp/ksp/tutorials/ex71.c

## Implementations

MatSetValuesBlockedLocal_IS() in src/mat/impls/is/matis.c

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