Registered Member
|
Hi there!
I have a very simple piece of code:
But I have an assert in lazyAssign due to evaluation of first result matrix:
If I compile with -DEIGEN_NO_DEBUG option I have unexpected output:
So why I can't just write Matrix<float, Dynamic, Dynamic> result = mat1.row(2)*mat2.transpose(); ? P.S. I have Ubuntu 9.10 x86_64, gcc 4.4.1 and Eigen 2.0.14. |
Registered Member
|
I don't yet know what's going on here. But I can reproduce it with gcc 4.3 and I can't see anything wrong with the code, so it does seem to be a bug in Eigen. The code seems to work fine with gcc 4.1. It appears possible to work around the bug with gcc 4.3 by replacing the line
by
Most worryingly for Eigen, the code written by OP does not compile with the current development version; it hits the static assertion YOU_TRIED_CALLING_A_VECTOR_METHOD_ON_A_MATRIX in MapBase.h:162 . |
Registered Member
|
Uh oh. Looks like we have some big fish to fry today
Join us on Eigen's IRC channel: #eigen on irc.freenode.net
Have a serious interest in Eigen? Then join the mailing list! |
Registered Member
|
I can reproduce the bug with gcc 4.4. The reason why GCC 4.1 works is that it's vectorization-related. Indeed, with -DEIGEN_DONT_VECTORIZE it works.
Join us on Eigen's IRC channel: #eigen on irc.freenode.net
Have a serious interest in Eigen? Then join the mailing list! |
Registered Member
|
The bug is twofold.
1) as you can see from the assert message, the rhs is a Dynamic x Dynamic matrix. It should be a row-vector (1 x Dynamic). 2) the left-hand side is initialized with size 32x1 whereas the right hand side has size 1x32. Since moreover the right-hand side is not a vector expression (see point 1), no transposing happens, leading to the size mismatch assertion failure.
Join us on Eigen's IRC channel: #eigen on irc.freenode.net
Have a serious interest in Eigen? Then join the mailing list! |
Registered Member
|
Nevermind point 1), I'm stupid, you _are_ assigning that to a matrix. So at least the bug is not twofold
Join us on Eigen's IRC channel: #eigen on irc.freenode.net
Have a serious interest in Eigen? Then join the mailing list! |
Registered Member
|
The bug is actually something internal to the product code. The mismatched size is on a Map, which is created internally in the product code. See backtrace:
Join us on Eigen's IRC channel: #eigen on irc.freenode.net
Have a serious interest in Eigen? Then join the mailing list! |
Moderator
|
thanks to all, bug fixed in the 2.0 branch.
For the devel branch I added a unit test which fails to compile. I'll fix later when updating the matrix-vector product because I don't want to do the work twice.... (moving from [] to .coeff() to [] again... don't follow me ? nevermind ) |
Registered Member
|
ilysenkov: are you (is your company) OK to use the 2.0 branch off hg for now? Or do you need (for a concrete reason) us to release 2.0.15 soon?
Join us on Eigen's IRC channel: #eigen on irc.freenode.net
Have a serious interest in Eigen? Then join the mailing list! |
Registered Member
|
Thanks for very quick response and fix!
bjacob: We are developing OpenCV library and using Eigen to speed up matrix multiplication if Eigen is installed on user's computer. We can't assume users will have latest version of Eigen with this bug fixed. So I just rewrote my code to sidestep this bug and we don't need new release. Thanks again for your help! |
Moderator
|
for the record this is also fixed in the devel branch
|
Registered users: Bing [Bot], Google [Bot], Sogou [Bot]