Fantastic Mr Fox
Fantastic Mr Fox

Reputation: 33904

Eigen Jacobi causing odd segfault in c++

So I have the following lines in my code:

MatrixXd qdash = zeroCentredMeasurementPointCloud_.topLeftCorner(3, zeroCentredMeasurementPointCloud_.cols());
Matrix3d H = q * qdash.transpose();
Eigen::JacobiSVD<MatrixXd> svd(H, Eigen::ComputeThinU | Eigen::ComputeThinV);

Now I am sure that qdash and H are being initialised correctly (q is also, just elsewhere). The last line, involving Eigen::JacobiSVD causes the program to throw this error when it is left in:

Program received signal SIGSEGV, Segmentation fault.
0xb0328af8 in _list_release () from /usr/qnx650/target/qnx6/x86/lib/libc.so.3

0  0xb0328af8 in _list_release () from /usr/qnx650/target/qnx6/x86/lib/libc.so.3
1  0xb032a464 in __free () from /usr/qnx650/target/qnx6/x86/lib/libc.so.3
2  0xb0329f7d in free () from /usr/qnx650/target/qnx6/x86/lib/libc.so.3

I.E. it is seg-faulting when trying to free it i guess. Now according to the tutorial here, all I should have to do to use this functionality is this:

MatrixXf m = MatrixXf::Random(3,2);
JacobiSVD<MatrixXf> svd(m, ComputeThinU | ComputeThinV);

Can anyone see why it is failing in my case?

Upvotes: 1

Views: 994

Answers (1)

Fantastic Mr Fox
Fantastic Mr Fox

Reputation: 33904

Ok so this is super crazy. Turns out I was using Eigen Alignment which doesnt really work on my operating system. This caused an error which would change location just based on the size of the executable that was produced.

The moral of the story is be careful with your includes.

Upvotes: 1

Related Questions