Skip to content

Commit 26f2a68

Browse files
Fabian Schenkmeta-codesync[bot]
authored andcommitted
const in parameters_errors functors
Differential Revision: D108284674 fbshipit-source-id: 836769c88074536927fe9337bb4892f4fa944919
1 parent fceeb94 commit 26f2a68

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

‎opensfm/src/bundle/error/parameters_errors.h‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ struct StdDeviationConstraint {
1010
template <typename T>
1111
bool operator()(const T* const std_deviation, T* residuals) const {
1212
constexpr double kEps = 1e-20;
13-
T std_sq = std_deviation[0] * std_deviation[0] + T(kEps);
13+
const T std_sq = std_deviation[0] * std_deviation[0] + T(kEps);
1414
residuals[0] = ceres::log(T(1.0) / ceres::sqrt(T(2.0 * M_PI) * std_sq));
1515
return true;
1616
}
@@ -22,11 +22,11 @@ struct ParameterBarrier {
2222

2323
template <typename T>
2424
bool operator()(const T* const parameters, T* residuals) const {
25-
T eps = T(1e-10);
26-
T value = parameters[index_];
27-
T zero = 2.0 * ceres::log((T(upper_bound_) - T(lower_bound_)) * 0.5);
28-
T penalty = ceres::log(value - T(lower_bound_) + eps) +
29-
ceres::log(T(upper_bound_) - value + eps);
25+
const T eps = T(1e-10);
26+
const T value = parameters[index_];
27+
const T zero = 2.0 * ceres::log((T(upper_bound_) - T(lower_bound_)) * 0.5);
28+
const T penalty = ceres::log(value - T(lower_bound_) + eps) +
29+
ceres::log(T(upper_bound_) - value + eps);
3030
residuals[0] = penalty + zero;
3131
return true;
3232
}

0 commit comments

Comments
 (0)