:orphan:
# MatCreateLRC
Creates a new matrix object that behaves like A + U*C*V' of type `MATLRC` 
## Synopsis
```
#include "petscmat.h" 
PetscErrorCode MatCreateLRC(Mat A, Mat U, Vec c, Mat V, Mat *N)
```
Collective


## Input Parameters

- ***A    -*** the (sparse) matrix (can be `NULL`)
- ***U    -*** dense rectangular (tall and skinny) matrix
- ***V    -*** dense rectangular (tall and skinny) matrix
- ***c    -*** a vector containing the diagonal of C (can be `NULL`)



## Output Parameter

- ***N    -*** the matrix that represents A + U*C*V'





## Notes
The matrix A + U*C*V' is not formed! Rather the new matrix
object performs the matrix-vector product `MatMult()`, by first multiplying by
A and then adding the other term.

`C` is a diagonal matrix (represented as a vector) of order k,
where k is the number of columns of both `U` and `V`.

If `A` is `NULL` then the new object behaves like a low-rank matrix U*C*V'.

Use `V`=`U` (or `V`=`NULL`) for a symmetric low-rank correction, A + U*C*U'.

If `c` is `NULL` then the low-rank correction is just U*V'.
If a sequential `c` vector is used for a parallel matrix,
PETSc assumes that the values of the vector are consistently set across processors.


## See Also
 [](ch_matrices), `Mat`, `MATLRC`, `MatLRCGetMats()`

## Level
intermediate

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/mat/impls/lrc/lrc.c.html#MatCreateLRC">src/mat/impls/lrc/lrc.c</A>

## Examples
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/tao/pde_constrained/tutorials/elliptic.c.html">src/tao/pde_constrained/tutorials/elliptic.c</A><BR>


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


[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)  
