mirror of
https://github.com/ceres-solver/ceres-solver.git
synced 2026-08-29 16:40:38 +08:00
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:
@@ -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_;
|
||||
|
||||
Reference in New Issue
Block a user