# MatLMVMUpdate
Adds (X-Xprev) and (F-Fprev) updates to an LMVM-type matrix. The first time the function is called for an LMVM-type matrix, no update is applied, but the given X and F vectors are stored for use as Xprev and Fprev in the next update. 
## Synopsis
```
#include "petscksp.h" 
PetscErrorCode MatLMVMUpdate(Mat B, Vec X, Vec F)
```
If the user has provided another LMVM-type matrix in place of J0, the J0
matrix is also updated recursively.


## Input Parameters

- ***B -*** An LMVM-type matrix
- ***X -*** Solution vector
- ***F -*** Function vector





## See Also
 [](chapter_ksp), [LMVM Matrices](sec_matlmvm), `MATLMVM`, `MatLMVMReset()`, `MatLMVMAllocate()`

## Level
intermediate

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ksp/ksp/utils/lmvm/lmvmutils.c.html#MatLMVMUpdate">src/ksp/ksp/utils/lmvm/lmvmutils.c</A>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/ksp/ksp/utils/lmvm/lmvmutils.c)


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