This bugzilla service is closed. All entries have been migrated to https://gitlab.com/libeigen/eigen
Bug 807 - Missing scalar type cast in umeyama()
Summary: Missing scalar type cast in umeyama()
Status: RESOLVED FIXED
Alias: None
Product: Eigen
Classification: Unclassified
Component: Geometry (show other bugs)
Version: 3.2
Hardware: All All
: Normal Unknown
Assignee: Nobody
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-05-05 11:12 UTC by newstzpz
Modified: 2019-12-04 13:18 UTC (History)
4 users (show)



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

Description 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<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.
Comment 1 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
Comment 2 Nobody 2019-12-04 13:18:14 UTC
-- 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.

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