diff options
Diffstat (limited to 'extern/ceres/internal/ceres/gradient_checker.cc')
-rw-r--r-- | extern/ceres/internal/ceres/gradient_checker.cc | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/extern/ceres/internal/ceres/gradient_checker.cc b/extern/ceres/internal/ceres/gradient_checker.cc index c16c141db09..ef56666970d 100644 --- a/extern/ceres/internal/ceres/gradient_checker.cc +++ b/extern/ceres/internal/ceres/gradient_checker.cc @@ -34,6 +34,7 @@ #include <algorithm> #include <cmath> +#include <cstdint> #include <numeric> #include <string> #include <vector> @@ -61,11 +62,11 @@ bool EvaluateCostFunction( Vector* residuals, std::vector<Matrix>* jacobians, std::vector<Matrix>* local_jacobians) { - CHECK_NOTNULL(residuals); - CHECK_NOTNULL(jacobians); - CHECK_NOTNULL(local_jacobians); + CHECK(residuals != nullptr); + CHECK(jacobians != nullptr); + CHECK(local_jacobians != nullptr); - const vector<int32>& block_sizes = function->parameter_block_sizes(); + const vector<int32_t>& block_sizes = function->parameter_block_sizes(); const int num_parameter_blocks = block_sizes.size(); // Allocate Jacobian matrices in local space. @@ -110,7 +111,7 @@ bool EvaluateCostFunction( Matrix global_J_local(global_size, local_size); local_parameterizations.at(i)->ComputeJacobian( parameters[i], global_J_local.data()); - local_jacobians->at(i) = jacobians->at(i) * global_J_local; + local_jacobians->at(i).noalias() = jacobians->at(i) * global_J_local; } } return true; @@ -122,20 +123,20 @@ GradientChecker::GradientChecker( const vector<const LocalParameterization*>* local_parameterizations, const NumericDiffOptions& options) : function_(function) { - CHECK_NOTNULL(function); + CHECK(function != nullptr); if (local_parameterizations != NULL) { local_parameterizations_ = *local_parameterizations; } else { local_parameterizations_.resize(function->parameter_block_sizes().size(), NULL); } - DynamicNumericDiffCostFunction<CostFunction, CENTRAL>* + DynamicNumericDiffCostFunction<CostFunction, RIDDERS>* finite_diff_cost_function = - new DynamicNumericDiffCostFunction<CostFunction, CENTRAL>( + new DynamicNumericDiffCostFunction<CostFunction, RIDDERS>( function, DO_NOT_TAKE_OWNERSHIP, options); finite_diff_cost_function_.reset(finite_diff_cost_function); - const vector<int32>& parameter_block_sizes = + const vector<int32_t>& parameter_block_sizes = function->parameter_block_sizes(); const int num_parameter_blocks = parameter_block_sizes.size(); for (int i = 0; i < num_parameter_blocks; ++i) { |