From a14ec27fb28ab2e8d7f1c9d88e41101dc6c0aab5 Mon Sep 17 00:00:00 2001 From: Richard Stebbing Date: Fri, 7 Aug 2015 08:42:03 -0700 Subject: [PATCH] Fix SparseNormalCholeskySolver with dynamic sparsity. The previous implementation incorrectly cached the outer product matrix pattern even when `dynamic_sparsity = true`. Change-Id: I1e58315a9b44f2f457d07c56b203ab2668bfb8a2 --- internal/ceres/sparse_normal_cholesky_solver.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/ceres/sparse_normal_cholesky_solver.cc b/internal/ceres/sparse_normal_cholesky_solver.cc index 495ed8753..ef9bcc7b1 100644 --- a/internal/ceres/sparse_normal_cholesky_solver.cc +++ b/internal/ceres/sparse_normal_cholesky_solver.cc @@ -203,7 +203,7 @@ LinearSolver::Summary SparseNormalCholeskySolver::SolveImplUsingEigen( // // TODO(sameeragarwal): See note about how this maybe a bad idea for // dynamic sparsity. - if (outer_product_.get() == NULL) { + if (outer_product_.get() == NULL || options_.dynamic_sparsity) { outer_product_.reset( CompressedRowSparseMatrix::CreateOuterProductMatrixAndProgram( *A, &pattern_)); @@ -306,7 +306,7 @@ LinearSolver::Summary SparseNormalCholeskySolver::SolveImplUsingCXSparse( // TODO(sameeragarwal): If dynamic sparsity is enabled, then this is // not a good idea performance wise, since the jacobian has far too // many entries and the program will go crazy with memory. - if (outer_product_.get() == NULL) { + if (outer_product_.get() == NULL || options_.dynamic_sparsity) { outer_product_.reset( CompressedRowSparseMatrix::CreateOuterProductMatrixAndProgram( *A, &pattern_));