Add IsParameterBlockConstant to the ceres::Problem class.
Change-Id: I7d0e828e81324443209c17fa54dd1d37605e5bfe
diff --git a/internal/ceres/problem_impl.cc b/internal/ceres/problem_impl.cc
index 7137616..4abea8b 100644
--- a/internal/ceres/problem_impl.cc
+++ b/internal/ceres/problem_impl.cc
@@ -573,6 +573,16 @@
parameter_block->SetConstant();
}
+bool ProblemImpl::IsParameterBlockConstant(double* values) const {
+ const ParameterBlock* parameter_block =
+ FindWithDefault(parameter_block_map_, values, NULL);
+ CHECK(parameter_block != NULL)
+ << "Parameter block not found: " << values << ". You must add the "
+ << "parameter block to the problem before it can be queried.";
+
+ return parameter_block->IsConstant();
+}
+
void ProblemImpl::SetParameterBlockVariable(double* values) {
ParameterBlock* parameter_block =
FindWithDefault(parameter_block_map_, values, NULL);