Registered Member
|
When I use the following line of code:
Eigen::Matrix<double,-1,-1> A; //Fill A with some value A = A.block(....) I get non-deterministic results in A (what look like unallocated values with amplitudes at 1e240 or so). This also works with A.middleCols(...) and others. Is this expected behavior? |
Moderator
|
Yes, this has to be expected, this is an aliasing issue as explained there: http://eigen.tuxfamily.org/dox-devel/gr ... asing.html
Basically, in your case, A gets resized and reallocated before copying the values... Either use conservativeResize, or make a temporary A = MatrixXd(A.block(...)); |
Registered users: Bing [Bot], Google [Bot], q.ignora, watchstar