Two bug fixes.
1. Add schur_templates.cc to Android.mk
2. When detecting the Schur structure of the Jacobian,
the check for whether linear solver being used is indeed
of Schur type or not, should use the LinearSolver::Options
struct created and populated by the preprocessor rather than
depending on the value in the input Solver::Options. The reason
is that the preprocessor may change the linear solver type
depending on the lack of a Schur structure in the problem.
Change-Id: I6f018f6817c05d704409181c7b1e25155528ab84
diff --git a/internal/ceres/solver.cc b/internal/ceres/solver.cc
index 716307a..705364b 100644
--- a/internal/ceres/solver.cc
+++ b/internal/ceres/solver.cc
@@ -382,7 +382,7 @@
&(summary->inner_iteration_ordering_used));
summary->inner_iterations_used = pp.inner_iteration_minimizer.get() != NULL; // NOLINT
- summary->linear_solver_type_used = pp.options.linear_solver_type;
+ summary->linear_solver_type_used = pp.linear_solver_options.type;
summary->num_linear_solver_threads_used = pp.options.num_linear_solver_threads; // NOLINT
summary->num_threads_used = pp.options.num_threads;
summary->preconditioner_type_used = pp.options.preconditioner_type; // NOLINT
@@ -540,7 +540,11 @@
const bool status = preprocessor->Preprocess(modified_options, problem_impl, &pp);
- if (IsSchurType(pp.options.linear_solver_type)) {
+ // We check the linear_solver_options.type rather than
+ // modified_options.linear_solver_type because, depending on the
+ // lack of a Schur structure, the preprocessor may change the linear
+ // solver type.
+ if (IsSchurType(pp.linear_solver_options.type)) {
// TODO(sameeragarwal): We can likely eliminate the duplicate call
// to DetectStructure here and inside the linear solver, by
// calling this in the preprocessor.
diff --git a/jni/Android.mk b/jni/Android.mk
index 565eeb3..d60c0fc 100644
--- a/jni/Android.mk
+++ b/jni/Android.mk
@@ -181,6 +181,7 @@
$(CERES_SRC_PATH)/schur_complement_solver.cc \
$(CERES_SRC_PATH)/schur_eliminator.cc \
$(CERES_SRC_PATH)/schur_jacobi_preconditioner.cc \
+ $(CERES_SRC_PATH)/schur_templates.cc \
$(CERES_SRC_PATH)/scratch_evaluate_preparer.cc \
$(CERES_SRC_PATH)/solver.cc \
$(CERES_SRC_PATH)/solver_utils.cc \