Registered Member
|
Hi all !
I am new to Eigen and I don't know if this problem is due to an improper use of Eigen or an internal bug. I want to copy a matrix block to the same matrix like this : MatrixXd m(10, 10); m = m.block(5, 5, 2, 2); Problem is that the copy operator doesn't seem to take into account that m.block(5, 5, 2, 2) is part of m, and it resizes m before doing the copy, which leads to the copy operator reading in a freed memory area. here is a sample test code and the valgrind output showing the issue :
valgrind ouput : http://pastebin.com/Fa97Fw6m |
Registered Member
|
This is the aliasing issue, see http://eigen.tuxfamily.org/dox/group__T ... asing.html . In short: For efficiency reasons, Eigen relies on the programmer to indicate that the block is part of m, by writing "m = m.block(5,5,2,2).eval()"
|
Registered users: Bing [Bot], Google [Bot], Yahoo [Bot]