Skip to main content
`Ctrl`+`K`

# MatLMVMUpdate

Adds (X-Xprev) and (F-Fprev) updates to a `MATLMVM` matrix.

## Synopsis

    #include "petscksp.h"
    PetscErrorCode MatLMVMUpdate(Mat B, Vec X, Vec F)

## Input Parameters

- B - A `MATLMVM` matrix

- X - Solution vector

- F - Function vector

## Notes

The first time this function is called for a `MATLMVM` matrix, no update is applied, but the given X and F vectors are stored for use as Xprev and Fprev in the next update.

If the user has provided another `MATLMVM` matrix for the reference Jacobian (using `MatLMVMSetJ0()`, for example), that matrix is also updated recursively.

If the sizes of `B` have not been specified (using `MatSetSizes()` or `MatSetLayouts()`) before `MatLMVMUpdate()` is called, the row size and layout of `B` will be set to match `F` and the column size and layout of `B` will be set to match `X`, and these sizes will be final.

## See Also

KSP: Linear System Solvers, LMVM Matrices, `MATLMVM`, `MatLMVMReset()`, `MatLMVMAllocate()`

## Level

intermediate

## Location

src/ksp/ksp/utils/lmvm/lmvmutils.c

Index of all KSP routines
Table of Contents for all manual pages
Index of all manual pages