mirror of
https://github.com/ceres-solver/ceres-solver.git
synced 2026-08-29 16:40:38 +08:00
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
This commit is contained in:
@@ -60,8 +60,7 @@ typename EigenTypes<kSize, kSize>::Matrix InvertPSDMatrix(
|
||||
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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user