# MatLMVMSetHistorySize
Set the number of past iterates to be stored for the construction of the limited-memory QN update. 
## Synopsis
```
#include "petscksp.h" 
PetscErrorCode MatLMVMSetHistorySize(Mat B, PetscInt hist_size)
```

## Input Parameters

- ***B -*** An LMVM-type matrix
- ***hist_size -*** number of past iterates (default 5)



## Options Database Key

- ***-mat_lmvm_hist_size <m> -*** set number of past iterates





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

## Level
beginner

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ksp/ksp/utils/lmvm/lmvmutils.c.html#MatLMVMSetHistorySize">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)  
