New user self-registration is disabled due to spam. Please email eigen-core-team @ lists.tuxfamily.org if you need an account.
Before reporting a bug, please make sure that your Eigen version is up-to-date!
Bug 807 - Missing scalar type cast in umeyama()
Missing scalar type cast in umeyama()
 Status: RESOLVED FIXED None Eigen Unclassified Geometry (show other bugs) 3.2 All All Normal Unknown Nobody

 Reported: 2014-05-05 11:12 UTC by newstzpz 2014-05-05 14:36 UTC (History) 4 users (show) chtz gael.guennebaud hauke.heibel jacob.benoit.1

Attachments
umeyama() with Scalar type cast added. (6.58 KB, application/octet-stream)
2014-05-05 11:12 UTC, newstzpz
no flags Details

 newstzpz 2014-05-05 11:12:16 UTC ```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(n); -> const RealScalar one_over_n = RealScalar(1) / static_cast(n); Line 139: if (sigma.determinant()<0) S(m-1) = -1; -> if (sigma.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.``` Christoph Hertzberg 2014-05-05 14:36:32 UTC ```Fixed in devel and 3.2 https://bitbucket.org/eigen/eigen/commits/bfe0a69 https://bitbucket.org/eigen/eigen/commits/e3e096c Thanks for the report```

 Note You need to log in before you can comment on or make changes to this bug.