Registered Member
|
I have a strange behaviour in the example below:
the output is 4 5 6 7 5 it should be 4 5 6 5 5 doesn't it ? The version of eigen I use is the 2.0 #include #include using namespace Eigen; using namespace std; int main() { Matrix3d C; C << 1, 2, 3, 4, 5, 6, 7, 8, 9; cout << C.row(1) << endl; cout << C.row(1)[1] << endl; Vector3d tmp = C.row(1); cout << tmp[1] << endl; } |
Registered Member
|
OK, you found a bug, and it's really embarrassing that something of that order of magnitude stayed unnoticed until now. However it's not in the row expression, it's in the MatrixBase::operator[].
I modified your testcase as follows:
And I get this output:
Inside the MatrixBase::operator[], the only potentially evil thing we do is derived() which is just a static_cast. Replacing that call by the static_cast makes no difference, so I am really puzzled. Gael to the rescue?
Join us on Eigen's IRC channel: #eigen on irc.freenode.net
Have a serious interest in Eigen? Then join the mailing list! |
Moderator
|
bug fixed,
the problem was in MapBase where the coeff(int) method was correct but not the coeffRef(int) one called by default by operator[int] and operator(int) |
Registered Member
|
Hi,
don't be ashamed, it is very normal to find bugs, that is why you made the lib public, isn't it? And by the way, you have the fastest response time I ever see. Thanks for the support and again, for the lib, I really love it. Manuel |
Registered users: Bing [Bot], Evergrowing, Google [Bot], rblackwell