aboutsummaryrefslogtreecommitdiff
path: root/internal/ceres/iterative_schur_complement_solver.cc
diff options
context:
space:
mode:
authorScott Ettinger <settinger@google.com>2013-09-09 12:54:43 -0700
committerScott Ettinger <settinger@google.com>2013-09-10 00:29:21 +0000
commit399f7d09e0c45af54b77b4ab9508d6f23759b927 (patch)
treeabf3b5ab8259679fb37a8e20308e8cd2a8cd439c /internal/ceres/iterative_schur_complement_solver.cc
parent1d2624a10e2c559f8ba9ef89eaa30832c0a83a96 (diff)
downloadceres-solver-399f7d09e0c45af54b77b4ab9508d6f23759b927.tar.gz
Bug: 10673139 Bug: 10621282 Change-Id: Ib740a6e0e29049cc203da9f083b0d4f5734a2741
Diffstat (limited to 'internal/ceres/iterative_schur_complement_solver.cc')
-rw-r--r--internal/ceres/iterative_schur_complement_solver.cc23
1 files changed, 17 insertions, 6 deletions
diff --git a/internal/ceres/iterative_schur_complement_solver.cc b/internal/ceres/iterative_schur_complement_solver.cc
index d39d7db..1aac565 100644
--- a/internal/ceres/iterative_schur_complement_solver.cc
+++ b/internal/ceres/iterative_schur_complement_solver.cc
@@ -78,6 +78,17 @@ LinearSolver::Summary IterativeSchurComplementSolver::SolveImpl(
}
schur_complement_->Init(*A, per_solve_options.D, b);
+ const int num_schur_complement_blocks =
+ A->block_structure()->cols.size() - options_.elimination_groups[0];
+ if (num_schur_complement_blocks == 0) {
+ VLOG(2) << "No parameter blocks left in the schur complement.";
+ LinearSolver::Summary cg_summary;
+ cg_summary.num_iterations = 0;
+ cg_summary.termination_type = TOLERANCE;
+ schur_complement_->BackSubstitute(NULL, x);
+ return cg_summary;
+ }
+
// Initialize the solution to the Schur complement system to zero.
//
// TODO(sameeragarwal): There maybe a better initialization than an
@@ -97,8 +108,8 @@ LinearSolver::Summary IterativeSchurComplementSolver::SolveImpl(
Preconditioner::Options preconditioner_options;
preconditioner_options.type = options_.preconditioner_type;
- preconditioner_options.sparse_linear_algebra_library =
- options_.sparse_linear_algebra_library;
+ preconditioner_options.sparse_linear_algebra_library_type =
+ options_.sparse_linear_algebra_library_type;
preconditioner_options.num_threads = options_.num_threads;
preconditioner_options.row_block_size = options_.row_block_size;
preconditioner_options.e_block_size = options_.e_block_size;
@@ -116,16 +127,16 @@ LinearSolver::Summary IterativeSchurComplementSolver::SolveImpl(
case SCHUR_JACOBI:
if (preconditioner_.get() == NULL) {
preconditioner_.reset(
- new SchurJacobiPreconditioner(
- *A->block_structure(), preconditioner_options));
+ new SchurJacobiPreconditioner(*A->block_structure(),
+ preconditioner_options));
}
break;
case CLUSTER_JACOBI:
case CLUSTER_TRIDIAGONAL:
if (preconditioner_.get() == NULL) {
preconditioner_.reset(
- new VisibilityBasedPreconditioner(
- *A->block_structure(), preconditioner_options));
+ new VisibilityBasedPreconditioner(*A->block_structure(),
+ preconditioner_options));
}
break;
default: