Fix update of L-BFGS history buffers after they become full.

Previously there was an assignment dimension mismatch in the
history update; thus, over time, the history would contain
(only) replicated copies of the (max_num_corrections_ -1)-th
update and the most recent update.

Change-Id: I26203acf689686d41a5029c675ebbe001fe05d90
This commit is contained in:
Alex Stewart
2013-06-30 18:49:56 +01:00
parent a427c877f9
commit 70b06c89c7
+3 -3
View File
@@ -58,16 +58,16 @@ bool LowRankInverseHessian::Update(const Vector& delta_x,
// TODO(sameeragarwal): This can be done more efficiently using
// a circular buffer/indexing scheme, but for simplicity we will
// do the expensive copy for now.
delta_x_history_.block(0, 0, num_parameters_, max_num_corrections_ - 2) =
delta_x_history_.block(0, 0, num_parameters_, max_num_corrections_ - 1) =
delta_x_history_
.block(0, 1, num_parameters_, max_num_corrections_ - 1);
delta_gradient_history_
.block(0, 0, num_parameters_, max_num_corrections_ - 2) =
.block(0, 0, num_parameters_, max_num_corrections_ - 1) =
delta_gradient_history_
.block(0, 1, num_parameters_, max_num_corrections_ - 1);
delta_x_dot_delta_gradient_.head(num_corrections_ - 2) =
delta_x_dot_delta_gradient_.head(num_corrections_ - 1) =
delta_x_dot_delta_gradient_.tail(num_corrections_ - 1);
} else {
++num_corrections_;