[eigen] unpleasant surprise mit math functions

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]


surprisingly, the following innocent looking code produces a segment fault.
From gdb's stack trace it looks as if it tries an infinite recursion.

#include <Eigen/Core>
using Eigen::VectorXd;  using Eigen::MatrixXd;
#include <iostream>
using std::cin;  using std::cout;  using std::cerr;  using std::endl;
#include <cmath>
using std::sin;  using std::cos;  using std::atan;

int main() {
  int N= 5,  m= 2;
  VectorXd t(N);
  MatrixXd A(N,m);

  t << 10, 20, 30, 40, 50;
  double F = 8*atan(1.0)/50;
  A.col(1)= sin(F*t);
  cout << A << endl;

Program received signal SIGSEGV, Segmentation fault.
0x000000000040254c in Eigen::internal::sin_default_impl<Eigen::CwiseUnaryOp<Eigen::internal::scalar_multiple_op<double>, Eigen::Matrix<double, -1, 1, 0, -1, 1> const>, false>::run ( x=<error reading variable: Cannot access memory at address 0x7fffff7feff0>)
    at /usr/local/include/Eigen/Eigen/src/Core/MathFunctions.h:476

This is with the mercurial version changeset: 4933:2d7c6bfc83dc Fri Sep 14 09:54:56 2012 +0200

Many thanks for any hint,

Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/