This bugzilla service is closed. All entries have been migrated to https://gitlab.com/libeigen/eigen

Bug 1033

Summary: Eigen with ceres solver problem
Product: Eigen Reporter: liu liu <815517729>
Component: InteroperabilityAssignee: Nobody <eigen.nobody>
Status: RESOLVED FIXED    
Severity: Compilation Problem CC: chtz, gael.guennebaud, hauke.heibel, jacob.benoit.1
Priority: Normal    
Version: 3.2   
Hardware: All   
OS: All   
Whiteboard:

Description liu liu 2015-07-02 09:16:23 UTC
the bug occurs when I try to implement the costfunction using ceres solver.

template <typename T>
bool operator()(const T*  q_cam_odo, const T* t_cam_odo, T* residuals) const
{
......

JacobiSVD<Matrix <T, 4, 4>> svd(Anorm, ComputeFullU | ComputeFullV);

......
}

but it reports a compilation error :

cannot covert the first argument from int to JetT


Then I follow the instructions to file <MathFunctions.h>

/****************************************************************************
* Implementation of hypot                                                *
****************************************************************************/

template<typename Scalar>
struct hypot_impl
{
  typedef typename NumTraits<Scalar>::Real RealScalar;
  static inline RealScalar run(const Scalar& x, const Scalar& y)
  {
    using std::max;
    using std::min;
    using std::abs;
    using std::sqrt;
    RealScalar _x = abs(x);
    RealScalar _y = abs(y);
    RealScalar p = (max)(_x, _y);
    if(p==RealScalar(0)) return 0;
    RealScalar q = (min)(_x, _y);
    RealScalar qp = q/p;
    return p * sqrt(RealScalar(1) + qp*qp);
  }
};


I just change the expression:
 if(p==RealScalar(0)) return 0;
to 
 if(p==RealScalar(0)) return RealScalar(0);

Thanks god, it's OK.
Comment 1 Christoph Hertzberg 2015-07-17 11:24:01 UTC
Thanks for the report. Fixed here:
https://bitbucket.org/eigen/eigen/commits/6feb93c7a8ec
Comment 2 Nobody 2019-12-04 14:43:35 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/1033.