Registered Member
|
Hi,
is there any way to divide each row of a matrix by a vector or each row of matrix by the corresponding row of another? I have this code in Matlab:
I have been trying to learn Eigen, but I don't know how to do the above. I have a few questions: 1) How to do the division part in Eigen?
2) Is it possible to do division of each row of a matrix by a vector?
I tried doing the following in Eigen:
where
But I get:
3) Is there any equivalent of Matlab's repmat in Eigen?
4) Is it possible to divide a Scalar by a vector/matrix?
5) In general, what are the Eigen equivalents of the Matlab operators?
Thanks in advance |
Registered Member
|
All these things are possible in Eigen and you should be able to find the syntax easily in the documentation. If you're using Eigen3 (which is currently only available as a beta version but very close to be released), here are some relevant links:
Sorry for the terse reply, but I don't have much time at the moment. If this does not help, let us know and I'll give more details later. |
Registered Member
|
Hello,
No, I'm using the stable Eigen 2
According to that link:
Should give me the result I wanted, but it fails to compile:
I'm using:
But don't blame it. My Eigen code has compiled and run fine up to now with that compiler. So, my question remains:
Thanks in advance |
Registered Member
|
Doesn't work under Linux either:
I'm using:
|
Moderator
|
The array syntax is for Eigen3 only. In Eigen2 you have to use the cwise() prefix syntax:
R = P .cwise()/ Q; See: http://eigen.tuxfamily.org/dox/Tutorial ... cOperators |
Registered users: bartoloni, Bing [Bot], Evergrowing, Google [Bot], ourcraft