changeset 9633:ecc2c556f844

simplify damped BFGS formula
author Jaroslav Hajek <highegg@gmail.com>
date Fri, 11 Sep 2009 08:47:25 +0200
parents 40acd13920e3
children da5ba66414a3
files scripts/ChangeLog scripts/optimization/fminunc.m
diffstat 2 files changed, 5 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/ChangeLog	Wed Sep 09 19:41:29 2009 -0400
+++ b/scripts/ChangeLog	Fri Sep 11 08:47:25 2009 +0200
@@ -1,3 +1,7 @@
+2009-09-11  Jaroslav Hajek  <highegg@gmail.com>
+
+	* optimization/fminunc.m: Simplify damped BFGS calculation.
+
 2009-09-09  Tatsuro Matsuoka <tmacchant@yahoo.co.jp>
 
 	* plot/gnuplot_drawnow.m: Avoid flickering windows by avoding
--- a/scripts/optimization/fminunc.m	Wed Sep 09 19:41:29 2009 -0400
+++ b/scripts/optimization/fminunc.m	Fri Sep 11 08:47:25 2009 +0200
@@ -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), "-");