From 3567c3a88846e227e0134b232ceafc7d15d15fa5 Mon Sep 17 00:00:00 2001 From: naoaki Date: Mon, 16 Feb 2009 05:59:00 +0000 Subject: [PATCH] Revert the previous commit. git-svn-id: file:///home/svnrepos/software/liblbfgs/trunk@31 ecf4c44f-38d1-4fa4-9757-a0b4dd0349fc --- lib/lbfgs.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lib/lbfgs.c b/lib/lbfgs.c index 1ef0ca7..47ec347 100644 --- a/lib/lbfgs.c +++ b/lib/lbfgs.c @@ -561,6 +561,7 @@ int lbfgs( vecncpy(d, g, n); } else { owlqn_direction(d, x, g, param.orthantwise_c, param.orthantwise_start, param.orthantwise_end); + veccpy(w, d, n); } j = end; @@ -586,6 +587,17 @@ int lbfgs( j = (j + 1) % m; /* if (++j == m) j = 0; */ } + /* + Constrain the search direction for orthant-wise updates. + */ + if (param.orthantwise_c != 0.) { + for (i = param.orthantwise_start;i < param.orthantwise_end;++i) { + if (d[i] * w[i] <= 0) { + d[i] = 0; + } + } + } + /* Now the search direction d is ready. We try step = 1 first. */