mirror of
https://github.com/ceres-solver/ceres-solver.git
synced 2026-08-29 16:40:38 +08:00
Fix a bug in DynamicAutoDiffCostFunction
DynamicAutoDiffCostFunction::Evaluate when provided with a jacobians array that was non-empty but all its entries are nullptr, would compute num_active_parameters = 0, and then skip over all the loops that evaluated the CostFunctor. The fix is to check if num_active_parameters == 0, and then treat it as the case where jacobians array is null. Thanks to Ky Waegel for reporting and providing a reproduction for this. Change-Id: Ib86930c2c3f722724d249f662bf88238679bbf98
This commit is contained in:
@@ -151,6 +151,9 @@ class DynamicAutoDiffCostFunction : public DynamicCostFunction {
|
||||
}
|
||||
}
|
||||
|
||||
if (num_active_parameters == 0) {
|
||||
return (*functor_)(parameters, residuals);
|
||||
}
|
||||
// When `num_active_parameters % Stride != 0` then it can be the case
|
||||
// that `active_parameter_count < Stride` while parameter_cursor is less
|
||||
// than the total number of parameters and with no remaining non-constant
|
||||
|
||||
Reference in New Issue
Block a user