Missing scalar type cast in umeyama()
Submitted by new..@..il.com
Assigned to Nobody
Link to original bugzilla bug (#807)
Version: 3.2
Description
Created attachment 460
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.
Attachment 460, "umeyama() with Scalar type cast added.":
Umeyama.h