mirror of
https://github.com/ceres-solver/ceres-solver.git
synced 2026-08-30 00:50:37 +08:00
Relax the requirements on loss functiond derivatives.
We now require that the first derivative of the loss function be positive only if the second derivative is non-zero. This is because when the second derivative is non-positive, we do not use the second order correction suggested by BANS and instead use a simpler first order strategy which does not use a division by the gradient of the loss function. Change-Id: I3d65713f152611998e196ff389a7081acfdfd8c1
This commit is contained in:
@@ -40,7 +40,6 @@ namespace internal {
|
||||
|
||||
Corrector::Corrector(const double sq_norm, const double rho[3]) {
|
||||
CHECK_GE(sq_norm, 0.0);
|
||||
CHECK_GT(rho[1], 0.0);
|
||||
sqrt_rho1_ = sqrt(rho[1]);
|
||||
|
||||
// If sq_norm = 0.0, the correction becomes trivial, the residual
|
||||
@@ -85,6 +84,14 @@ Corrector::Corrector(const double sq_norm, const double rho[3]) {
|
||||
return;
|
||||
}
|
||||
|
||||
// We now require that the first derivative of the loss function be
|
||||
// positive only if the second derivative is non-zero. This is
|
||||
// because when the second derivative is non-positive, we do not use
|
||||
// the second order correction suggested by BANS and instead use a
|
||||
// simpler first order strategy which does not use a division by the
|
||||
// gradient of the loss function.
|
||||
CHECK_GT(rho[1], 0.0);
|
||||
|
||||
// Calculate the smaller of the two solutions to the equation
|
||||
//
|
||||
// 0.5 * alpha^2 - alpha - rho'' / rho' * z'z = 0.
|
||||
|
||||
Reference in New Issue
Block a user