From f402c1724765befb37f8b31d4e6c11c0906f03ec Mon Sep 17 00:00:00 2001 From: Sameer Agarwal Date: Wed, 26 Jul 2017 21:03:34 -0700 Subject: [PATCH] InvertPSDMatrix uses dynamic matrices when using SVD The JacobiSVD algorithm in Eigen does not accept fixed sized matrices when performing a thin SVD. The assert enforcing this is only triggered in non-Release builds. So this change calls JacobiSVD with dynamically sized matrices as a template parameter rather than a fixed size matrix. https://github.com/ceres-solver/ceres-solver/issues/304#issuecomment-317965814 Thanks to @debalance for reporting this and @leokoppel for providing a reproduction. Change-Id: Ifc3d9ff20d5597f08c0f8573bf2fd99a3ed3d4d3 --- internal/ceres/invert_psd_matrix.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/internal/ceres/invert_psd_matrix.h b/internal/ceres/invert_psd_matrix.h index 34daf88ab..2319fea02 100644 --- a/internal/ceres/invert_psd_matrix.h +++ b/internal/ceres/invert_psd_matrix.h @@ -60,8 +60,7 @@ typename EigenTypes::Matrix InvertPSDMatrix( Matrix::Identity(size, size)); } - Eigen::JacobiSVD::Matrix> svd( - m, Eigen::ComputeThinU | Eigen::ComputeThinV); + Eigen::JacobiSVD svd(m, Eigen::ComputeThinU | Eigen::ComputeThinV); const double tolerance = std::numeric_limits::epsilon() * size * svd.singularValues()(0);