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
diff --git a/internal/ceres/low_rank_inverse_hessian.cc b/internal/ceres/low_rank_inverse_hessian.cc index 3fe113f..4fabd5b 100644 --- a/internal/ceres/low_rank_inverse_hessian.cc +++ b/internal/ceres/low_rank_inverse_hessian.cc
@@ -58,16 +58,16 @@ // 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_;