# MatLMVMAllocate
Produces all necessary common memory for LMVM approximations based on the solution and function vectors provided. If `MatSetSizes()` and `MatSetUp()` have not been called before `MatLMVMAllocate()`, the allocation will read sizes from the provided vectors and update the matrix. 
## Synopsis
```
#include "petscksp.h" 
PetscErrorCode MatLMVMAllocate(Mat B, Vec X, Vec F)
```

## Input Parameters

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





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

## Level
intermediate

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