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
diff --git a/internal/ceres/invert_psd_matrix.h b/internal/ceres/invert_psd_matrix.h index 34daf88..2319fea 100644 --- a/internal/ceres/invert_psd_matrix.h +++ b/internal/ceres/invert_psd_matrix.h
@@ -60,8 +60,7 @@ Matrix::Identity(size, size)); } - Eigen::JacobiSVD<typename EigenTypes<kSize, kSize>::Matrix> svd( - m, Eigen::ComputeThinU | Eigen::ComputeThinV); + Eigen::JacobiSVD<Matrix> svd(m, Eigen::ComputeThinU | Eigen::ComputeThinV); const double tolerance = std::numeric_limits<double>::epsilon() * size * svd.singularValues()(0);