Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/torch/optim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClement Farabet <clement.farabet@gmail.com>2012-05-03 08:42:17 +0400
committerClement Farabet <clement.farabet@gmail.com>2012-05-03 08:42:17 +0400
commit3e6e3681aa29a29c40e80cfd9b80b7d00f0be037 (patch)
tree0c7d90d2ea5a77173920010dce2d975e075c2966 /lswolfe.lua
parentf02b1cf8bb4fa215c7b6ecc1a9638db19fcae0f5 (diff)
Fixed subtle bug in wolfe line search
Diffstat (limited to 'lswolfe.lua')
-rw-r--r--lswolfe.lua8
1 files changed, 3 insertions, 5 deletions
diff --git a/lswolfe.lua b/lswolfe.lua
index 3e949cd..076f5a4 100644
--- a/lswolfe.lua
+++ b/lswolfe.lua
@@ -94,7 +94,7 @@ function optim.lswolfe(opfunc,x,t,d,f,g,gtd,options)
-- next step:
f_prev = f_new
- g_prev = g_new
+ g_prev = g_new:clone()
gtd_prev = gtd_new
x[{}] = x_init
x:add(t,d)
@@ -183,15 +183,13 @@ function optim.lswolfe(opfunc,x,t,d,f,g,gtd,options)
verbose('reached max number of iterations')
end
- -- return final vector
- x[{}] = x_init
- x:add(t,d)
-
-- return stuff
local _,LOpos = bracketFval:min(1)
LOpos = LOpos[1]
t = bracket[LOpos]
f_new = bracketFval[LOpos]
g_new = bracketGval[LOpos]
+ x[{}] = x_init
+ x:add(t,d)
return f_new,g_new,x,t,lsFuncEval
end