# HG changeset patch # User Jaroslav Hajek # Date 1252651645 -7200 # Node ID ecc2c556f844b30734ac42e2474e90d593197bcf # Parent 40acd13920e36f2e0ac9318cf9f96017ecd8a515 simplify damped BFGS formula diff --git a/scripts/ChangeLog b/scripts/ChangeLog --- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,3 +1,7 @@ +2009-09-11 Jaroslav Hajek + + * optimization/fminunc.m: Simplify damped BFGS calculation. + 2009-09-09 Tatsuro Matsuoka * plot/gnuplot_drawnow.m: Avoid flickering windows by avoding diff --git a/scripts/optimization/fminunc.m b/scripts/optimization/fminunc.m --- a/scripts/optimization/fminunc.m +++ b/scripts/optimization/fminunc.m @@ -170,11 +170,7 @@ sBs = sumsq (w); Bs = hesr'*w; sy = y'*s; - if (sy >= 0.2*sBs) - theta = 1; - else - theta = 0.8*sBs / (sBs - sy); - endif + theta = 0.8 / max (1 - sy / sBs, 0.8); r = theta * y + (1-theta) * Bs; hesr = cholupdate (hesr, r / sqrt (s'*r), "+"); [hesr, info] = cholupdate (hesr, Bs / sqrt (sBs), "-");