# MatSetValuesRow
Inserts a row (block row for `MATBAIJ` matrices) of nonzero values into a matrix 
## Synopsis
```
#include "petscmat.h" 
PetscErrorCode MatSetValuesRow(Mat mat, PetscInt row, const PetscScalar v[])
```
Not Collective


## Input Parameters

- ***mat -*** the matrix
- ***row -*** the (block) row to set
- ***v -*** a logically two-dimensional (column major) array of values for  block matrices with blocksize larger than one, otherwise a one dimensional array of values





## Notes
The values, `v`, are column-oriented for the block version.

All the nonzeros in the row must be provided

THE MATRIX MUST HAVE PREVIOUSLY HAD ITS COLUMN INDICES SET. IT IS RARE THAT THIS ROUTINE IS USED, usually `MatSetValues()` is used.

The row must belong to this process


## See Also
 `Mat`, `MatSetValues()`, `MatSetOption()`, `MatAssemblyBegin()`, `MatAssemblyEnd()`, `MatSetValuesBlocked()`, `MatSetValuesLocal()`,
`InsertMode`, `INSERT_VALUES`, `ADD_VALUES`, `MatSetValues()`

## Level
advanced

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/mat/interface/matrix.c.html#MatSetValuesRow">src/mat/interface/matrix.c</A>

## Implementations

<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/mat/impls/aij/mpi/mpiaij.c.html#MatSetValuesRow_MPIAIJ">MatSetValuesRow_MPIAIJ in src/mat/impls/aij/mpi/mpiaij.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/mat/impls/aij/seq/aij.c.html#MatSetValuesRow_SeqAIJ">MatSetValuesRow_SeqAIJ in src/mat/impls/aij/seq/aij.c</A><BR>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/mat/interface/matrix.c)


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