# Difference between revisions of "Lbfgs.m"

This function calculates the quasi-Newton update with the gradient history, giving the search direction. Based on the BFGS algorithm, this limited-memory BFGS (L-BFGS) algorithm stores only few vectors that implicitly represent the approximation of the BFGS algorithm (which stores a matrix equal to the number of optimisation variables)

## Syntax

    direction=lbfgs(x_hist,df_hist,grad,N)


## Description

This function is the implementation from section 4 of http://dx.doi.org/10.1090/S0025-5718-1980-0572855-7

## Arguments

    x_hist         - vector array of waveform history, num_var x size_store

df_hist        - vector array of gradient history, num_var x size_store

N              - number of waveform/gradient vectors to store (default=20)


## Returns

    direction      - the vector giving the BFGS approximation to the search direction


## Notes

The L-BFGS algorithm is the default of fminnewton.m, and should be considered a good mix of computational efficiency and fast convergence.