Stack overflow with sqrt of an expression which returns a double (a 1x1 return type)
Submitted by Tom
Assigned to Nobody
Link to original bugzilla bug (#508)
Version: 3.1
Operating system: Windows
Description
int main(int argc, char* argv[])
{
Eigen::Vector2d v(1.0,2.0);
double d = sqrt(v.transpose() * v);
}
This triggers an infinite recursion/stack overflow when sqrt and sqrt_default_impl call each other.
Easy to work around--e.g. sqrt(v.dot(v));
Copied from the call stack:
Eigen::internal::sqrt_default_impl<Eigen::GeneralProduct<Eigen::Transpose<Eigen::Matrix<double,2,1,0,2,1> >,Eigen::Matrix<double,2,1,0,2,1>,3>,0>::run(const Eigen::GeneralProduct<Eigen::Transpose<Eigen::Matrix<double,2,1,0,2,1> >,Eigen::Matrix<double,2,1,0,2,1>,3> & x) Line 417 + 0xa bytes C++
Eigen::internal::sqrt<Eigen::GeneralProduct<Eigen::Transpose<Eigen::Matrix<double,2,1,0,2,1> >,Eigen::Matrix<double,2,1,0,2,1>,3> >(const Eigen::GeneralProduct<Eigen::Transpose<Eigen::Matrix<double,2,1,0,2,1> >,Eigen::Matrix<double,2,1,0,2,1>,3> & x) Line 447 + 0xf bytes C++
Blocking
Edited by Eigen Bugzilla