:orphan:
# MatSetValuesDevice
sets a set of values into a matrix, this may be called by CUDA or KOKKOS kernels 
## Synopsis
```
int
  MatSetValuesDevice(PetscSplitCSRDataStructure d_mat, PetscInt m, const PetscInt im[], PetscInt n, const PetscInt in[], const PetscScalar v[], InsertMode is)
```

## Input Parameters

- ***d_mat -*** an object obtained with `MatCUSPARSEGetDeviceMatWrite()` or `MatKokkosGetDeviceMatWrite()`
- ***m -*** the number of rows to insert or add to
- ***im -*** the rows to insert or add to
- ***n -*** number of columns to insert or add to
- ***in -*** the columns to insert or add to
- ***v -*** the values to insert or add to the matrix (treated as a  by n row oriented dense array
- ***is -*** either `INSERT_VALUES` or `ADD_VALUES`





## Notes
Any row or column indices that are outside the bounds of the matrix on the rank are discarded

It is recommended that `MatSetValuesCOO()` be used instead of this routine for efficiency


## See Also
 `MatSetValues()`, `MatCreate()`, `MatCreateDenseCUDA()`, `MatCreateAIJCUSPARSE()`, `MatKokkosGetDeviceMatWrite()`,
`MatCUSPARSEGetDeviceMatWrite()`, `MatSetValuesCOO()`

## Level
advanced

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/include/petscaijdevice.h.html#MatSetValuesDevice">include/petscaijdevice.h</A>

## Examples
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/mat/tutorials/ex5cu.cu.html">src/mat/tutorials/ex5cu.cu</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/mat/tutorials/ex5k.kokkos.cxx.html">src/mat/tutorials/ex5k.kokkos.cxx</A><BR>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/include/petscaijdevice.h)


[Index of all Mat routines](index.md)  
[Table of Contents for all manual pages](/manualpages/index.md)  
[Index of all manual pages](/manualpages/singleindex.md)  
