Registered Member
|
Hello,
I have a compilation error concerning the operator+. It seems that this operator for scalars is defined but it does not compile. I use the eigen library distributed on ubuntu.
the compile error message : /home/rtrepos/usr/src/vle_dev/eigen_utils/src/test_eigen_utils.cpp: In function ‘int main(int, const char**)’: /home/rtrepos/usr/src/vle_dev/eigen_utils/src/test_eigen_utils.cpp:300: error: no match for ‘operator+’ in ‘x + 10’ Best regards. |
Moderator
|
have a look at the tutorial:
http://eigen.tuxfamily.org/dox/Tutorial ... cOperators the correct syntax for this operation is: xx = x .cwise()+ 10; here you have to add the .cwise() prefix to make it clear you don't want to add 10 to all coefficients in contrast to: x + 10 I where I is the identity matrix. |
Registered Member
|
You can't add a number to a vector like that. If you want to add that number to all coeffs of the vector, do:
Note that "cwise()" is just a "prefix" for the operator+. That's why you write it only on the left hand side, and the result of the operator+ is again just a vector expression.
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
|
Sorry, actually I saw it on the tutorial but I forgot it.
Thank you, I'll take more time before posting now.. |
Registered users: Bing [Bot], daret, Google [Bot], sandyvee, Sogou [Bot]