Skip to content

Instantly share code, notes, and snippets.

@antoine-levitt
Created April 7, 2018 13:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save antoine-levitt/61d15204fbd442e098f611d696b75cb7 to your computer and use it in GitHub Desktop.
Save antoine-levitt/61d15204fbd442e098f611d696b75cb7 to your computer and use it in GitHub Desktop.
n = 100
A = randn(n,n)
A = A'A + I
b = randn(n)
f(x) = vecdot(x,A*x)/2 - vecdot(b,x)
g(x) = A*x-b
g!(stor,x) = copy!(stor,g(x))
x0 = randn(n)
solver = Optim.LBFGS()
res = Optim.optimize(f, g!, x0, solver,Optim.Options(iterations=1000))
display(res)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment