This forum has been archived. All content is frozen. Please use KDE Discuss instead.

segmentation fault - me or bug?

Tags: None
(comma "," separated)
owens
Registered Member
Posts
4
Karma
0

segmentation fault - me or bug?

Wed Apr 11, 2012 4:26 am
The follow code seg faults for me. Did I miss something in the documentation? Or should I file this as a bug? I am using Linux and the 3.0.5 release of Eigen.

Code: Select all
#include <Eigen/Dense>

int
main()
{
    Eigen::MatrixXd A (1, 3);
    A << 1, 2, 3;

    Eigen::MatrixXd B (3, 1);
    B << 4, 5, 6;

    double p = (A * B)(0, 0);

    return 0;
}
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS

Re: segmentation fault - me or bug?

Thu Apr 12, 2012 6:41 am
hm, you should get a compilation error. so please fill a bug report. In your case you should really use VectorXd, in which case the index based accessor will be allowed, e.g:

VectorXd A, B;
...
double p = (A.transpose() * B)(0,0);
double p = (A.transpose() * B)(0);
double p = A.transpose() * B;
etc.

see also http://eigen.tuxfamily.org/dox-devel/Qu ... cOperators for other variants:
owens
Registered Member
Posts
4
Karma
0

Re: segmentation fault - me or bug?

Thu Apr 12, 2012 10:31 pm
Thanks ggael, I have filed a new bug (linked below). Good suggestion about Vector. The work around I used was saving the product to a variable.

http://eigen.tuxfamily.org/bz/show_bug.cgi?id=447


Bookmarks



Who is online

Registered users: Bing [Bot], claydoh, Google [Bot], rblackwell, Yahoo [Bot]