Summary: | Missing scalar type cast in umeyama() | ||||||
---|---|---|---|---|---|---|---|
Product: | Eigen | Reporter: | newstzpz | ||||
Component: | Geometry | Assignee: | Nobody <eigen.nobody> | ||||
Status: | RESOLVED FIXED | ||||||
Severity: | Unknown | CC: | chtz, gael.guennebaud, hauke.heibel, jacob.benoit.1 | ||||
Priority: | Normal | ||||||
Version: | 3.2 | ||||||
Hardware: | All | ||||||
OS: | All | ||||||
Whiteboard: | |||||||
Attachments: |
|
Fixed in devel and 3.2 https://bitbucket.org/eigen/eigen/commits/bfe0a69 https://bitbucket.org/eigen/eigen/commits/e3e096c Thanks for the report -- GitLab Migration Automatic Message -- This bug has been migrated to gitlab.com's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.com/libeigen/eigen/issues/807. |
Created attachment 460 [details] umeyama() with Scalar type cast added. In the function umeyama() in file Umeyama.h line 116, 139, 145, 148 and 159, the constant scalars in the code should be casted to Scalar type in order to use this function with some scalar types like ceres::Jet. Line 116: const RealScalar one_over_n = 1 / static_cast<RealScalar>(n); -> const RealScalar one_over_n = RealScalar(1) / static_cast<RealScalar>(n); Line 139: if (sigma.determinant()<0) S(m-1) = -1; -> if (sigma.determinant()<Scalar(0)) S(m-1) = Scalar(-1); Line 145: if ( svd.matrixU().determinant() * svd.matrixV().determinant() > 0 ) { -> if ( svd.matrixU().determinant() * svd.matrixV().determinant() > Scalar(0) ) { Line 148: const Scalar s = S(m-1); S(m-1) = -1; -> const Scalar s = S(m-1); S(m-1) = Scalar(-1); Line 159: const Scalar c = 1/src_var * svd.singularValues().dot(S); -> const Scalar c = Scalar(1)/src_var * svd.singularValues().dot(S); The attachment is the file with Scalar type cast added.