update the lbfgs optimizer

@karlnapf 
Please merge this first.
I will send additional two PRs for dual likelihoods and dual KL method respectively once this is merged.