Registered Member
|
In trying to track down a bug in some code that uses Eigen I've been able to come up with the following simple program which illustrates the issue:
The output of this program is:
Running the resulting code under valgrind produces a Uninitialised value was created by a stack allocation error. Is there anything wrong with the above code? As the original mat matrix is in scope at the point where the matrix is evaluated, why does it matter that I'm creating temporaries of Eigen::DenseBase expressions? I have tried compiling with Eigen 3.2.1 as well as Eigen 3.2.2 and got the same result. I've posted this on Stack Overflow as well. |
Registered Member
|
Removing the "array()" calls resolved the issue, as per this answer on stack overflow. If someone could offer a workaround in situations where you don't know the incoming type (ie. you have to assume it is DenseBase) but require array functionality that would be great!
|
Moderator
|
For the record, there was a shortcoming in ArrayWrapper. Fixed now (the first example does work):
https://bitbucket.org/eigen/eigen/commits/589ff21345fa/ Changeset: 589ff21345fa User: ggael Date: 2014-09-10 10:33:19 Summary: ArrayWrapper and MatrixWrapper classes should not be nested by reference. |
Registered users: Bing [Bot], claydoh, Google [Bot], rblackwell, Yahoo [Bot]