Add Problem::SetParameterLowerBound and Problem::SetParameterUpperBound.
These two methods allow the user to associate upper and lower bounds
with individual parameters inside parameter blocks.
Change-Id: I68dc37f20b64408da510ba06b89a4f08df54ddad
diff --git a/internal/ceres/problem.cc b/internal/ceres/problem.cc
index bc6d26a..9bdc1ef 100644
--- a/internal/ceres/problem.cc
+++ b/internal/ceres/problem.cc
@@ -183,6 +183,18 @@
return problem_impl_->GetParameterization(values);
}
+void Problem::SetParameterLowerBound(double* values,
+ int index,
+ double lower_bound) {
+ problem_impl_->SetParameterLowerBound(values, index, lower_bound);
+}
+
+void Problem::SetParameterUpperBound(double* values,
+ int index,
+ double upper_bound) {
+ problem_impl_->SetParameterUpperBound(values, index, upper_bound);
+}
+
bool Problem::Evaluate(const EvaluateOptions& evaluate_options,
double* cost,
vector<double>* residuals,
diff --git a/internal/ceres/problem_impl.cc b/internal/ceres/problem_impl.cc
index 9882677..99f3f89 100644
--- a/internal/ceres/problem_impl.cc
+++ b/internal/ceres/problem_impl.cc
@@ -541,6 +541,20 @@
->local_parameterization();
}
+void ProblemImpl::SetParameterLowerBound(double* values,
+ int index,
+ double lower_bound) {
+ FindParameterBlockOrDie(parameter_block_map_, values)
+ ->SetLowerBound(index, lower_bound);
+}
+
+void ProblemImpl::SetParameterUpperBound(double* values,
+ int index,
+ double upper_bound) {
+ FindParameterBlockOrDie(parameter_block_map_, values)
+ ->SetUpperBound(index, upper_bound);
+}
+
bool ProblemImpl::Evaluate(const Problem::EvaluateOptions& evaluate_options,
double* cost,
vector<double>* residuals,
diff --git a/internal/ceres/problem_impl.h b/internal/ceres/problem_impl.h
index da50578..75bdc2b 100644
--- a/internal/ceres/problem_impl.h
+++ b/internal/ceres/problem_impl.h
@@ -129,6 +129,9 @@
LocalParameterization* local_parameterization);
const LocalParameterization* GetParameterization(double* values) const;
+ void SetParameterLowerBound(double* values, int index, double lower_bound);
+ void SetParameterUpperBound(double* values, int index, double upper_bound);
+
bool Evaluate(const Problem::EvaluateOptions& options,
double* cost,
vector<double>* residuals,