Registered Member
|
Hi,
I wanted to implement a scalar / matrix operator, to be able to use this kind of syntax: "2 + mat". And then extend it to have "1 / mat" and so on. I declared this:
The compilation failed, and I got this error message:
Did I miss something obvious ? Is there an easy way to implement what I want ? Thank you for you help ! |
Registered Member
|
I did not see that this is a simple example provided by http://eigen.tuxfamily.org/dox-devel/To ... Eigen.html, which works.
Is there a simple that could make my first solution work without without defining a friend function in MatrixBaseAddons.h, out of curiosity ? |
Registered Member
|
I added this function:
However this code:
outputs:
I do not understand why the operation is correctly applied on all elements of the vector but the first ? |
Registered Member
|
The correct implementation is described in this post: viewtopic.php?f=74&t=127727.
|
Moderator
|
Note that what your are looking for is Array<>, not Matrix<>, for which all these operations are already available. See: http://eigen.tuxfamily.org/dox/group__T ... Class.html
|
Registered users: Bing [Bot], Google [Bot], q.ignora, watchstar