Call EvaluationCallback before evaluating the fixed cost.

Fixe a subtle bug in Program::RemoveFixedBlocks, where we call
ResidualBlock::Evaluate on residual blocks with all constant parameter
blocks without paying attention to the presence of an
EvaluationCallback.

In the process also run clang-format on some of the files touched by
this change.

https://github.com/ceres-solver/ceres-solver/issues/482

Change-Id: I342b66f6f975fdee2eef139a31f24d4a3e568e84
This commit is contained in:
Sameer Agarwal
2020-05-22 13:52:53 -07:00
parent 70308f7bb9
commit a614f788a3
4 changed files with 203 additions and 102 deletions
+4 -5
View File
@@ -35,12 +35,11 @@
#include <set>
#include <string>
#include <vector>
#include "ceres/internal/port.h"
#include "ceres/evaluation_callback.h"
namespace ceres {
class EvaluationCallback;
namespace internal {
class ParameterBlock;
@@ -76,8 +75,8 @@ class Program {
// computation of the Jacobian of its local parameterization. If
// this computation fails for some reason, then this method returns
// false and the state of the parameter blocks cannot be trusted.
bool StateVectorToParameterBlocks(const double *state);
void ParameterBlocksToStateVector(double *state) const;
bool StateVectorToParameterBlocks(const double* state);
void ParameterBlocksToStateVector(double* state) const;
// Copy internal state to the user's parameters.
void CopyParameterBlockStateToUserState();