.hnormalized() produces compilation errors
Submitted by Sergiu Deitsch
Assigned to Nobody
Link to original bugzilla bug (#997)
Version: 3.2
Description
I have the following function, which is used in combination with ceres::Jet<> as scalar:
template
<
class Derived1,
class Derived2
inline Eigen::Matrix<typename Eigen::MatrixBase<Derived1>::Scalar, 2, 1> reproject(
const Eigen::MatrixBase<Derived1>& pt,
const Eigen::MatrixBase<Derived2>& W
)
{
return (W * pt.homogeneous()).hnormalized();
}
If I don't call .eval() before .hnormalized() this results in the following compilation error:
/usr/include/eigen3/Eigen/src/Core/DenseCoeffsBase.h:137:14: error: no viable conversion from 'const
Eigen::ReturnByValue<Eigen::internal::homogeneous_left_product_impl<Eigen::Homogeneous<Eigen::Matrix<double, 2, 1, 0, 2, 1>, 0>, Eigen::Matrix<double, 3, 3, 0,
3, 3> > >::YOU_ARE_TRYING_TO_ACCESS_A_SINGLE_COEFFICIENT_IN_A_SPECIAL_EXPRESSION_WHERE_THAT_IS_NOT_ALLOWED_BECAUSE_THAT_WOULD_BE_INEFFICIENT' to 'const double'
return derived().coeff(index);
^~~~~~~~~~~~~~~~~~~~~~
/usr/include/eigen3/Eigen/src/Geometry/Homogeneous.h:163:40: note: in instantiation of member function
'Eigen::DenseCoeffsBase<Eigen::ReturnByValue<Eigen::internal::homogeneous_left_product_impl<Eigen::Homogeneous<Eigen::Matrix<double, 2, 1, 0, 2, 1>, 0>,
Eigen::Matrix<double, 3, 3, 0, 3, 3> > >, 0>::coeff' requested here
ColsAtCompileTime==1?1:size()-1) / coeff(size()-1);
I'm using Clang 3.6 and Eigen 3.2.4.