mirror of
https://github.com/ceres-solver/ceres-solver.git
synced 2026-08-30 00:50:37 +08:00
Allow the LossFunction contained in a LossFunctionWrapper to be NULL.
This is consistent with how NULL LossFunctions are treated everywhere else. Change-Id: Ic91e39ccb13137fcad7f85e78613a29ecde30d67
This commit is contained in:
@@ -358,6 +358,9 @@ class CERES_EXPORT ScaledLoss : public LossFunction {
|
||||
// whose scale can be mutated after an optimization problem has been
|
||||
// constructed.
|
||||
//
|
||||
// Since we treat the a NULL Loss function as the Identity loss
|
||||
// function, rho = NULL is a valid input.
|
||||
//
|
||||
// Example usage
|
||||
//
|
||||
// Problem problem;
|
||||
@@ -394,8 +397,14 @@ class CERES_EXPORT LossFunctionWrapper : public LossFunction {
|
||||
}
|
||||
|
||||
virtual void Evaluate(double sq_norm, double out[3]) const {
|
||||
CHECK_NOTNULL(rho_.get());
|
||||
rho_->Evaluate(sq_norm, out);
|
||||
if (rho_.get() == NULL) {
|
||||
out[0] = sq_norm;
|
||||
out[1] = 1.0;
|
||||
out[2] = 0.0;
|
||||
}
|
||||
else {
|
||||
rho_->Evaluate(sq_norm, out);
|
||||
}
|
||||
}
|
||||
|
||||
void Reset(LossFunction* rho, Ownership ownership) {
|
||||
|
||||
Reference in New Issue
Block a user