Skip to main content
`Ctrl`+`K`

# MatGetValuesLocal

retrieves values from certain locations in a matrix using the local numbering of the indices defined previously by `MatSetLocalToGlobalMapping()`

## Synopsis

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

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

## Output Parameter

- 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.

## Notes

If you create the matrix yourself (that is not with a call to `DMCreateMatrix()`) then you MUST call `MatSetLocalToGlobalMapping()` before using this routine.

This routine can only return values that are owned by the requesting MPI process. That is, for standard matrix formats, rows that, in the global numbering, are greater than or equal to rstart and less than rend where rstart and rend are obtainable from `MatGetOwnershipRange`(mat,&rstart,&rend). One can determine if the resulting global row associated with the local row r is owned by the requesting MPI process by applying the `ISLocalToGlobalMapping` set with `MatSetLocalToGlobalMapping()`.

## See Also

Matrices, `Mat`, `MatAssemblyBegin()`, `MatAssemblyEnd()`, `MatSetValues()`, `MatSetLocalToGlobalMapping()`, `MatSetValuesLocal()`, `MatGetValues()`

## Level

advanced

## Location

src/mat/interface/matrix.c

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