May I please seek help with a computation issue of the matrix library "Eigen."
say i have a functor:
struct my_F
{
double a_,b_;
my_F(double a,double b):a_(a),b_(b){};
double operator()(double x){return (x+a)*(x+b);}
}
Now I want to use this functor to operate on a Eigen::MatrixXd
Eigen::MatrixXd a(10,12);
a.setConstant(2.);
How do I write something (in a compact and nice way) so that each element of "a" is taken and the functor operation to it is applied.
I can always do it in a loop but is that the only way out ?
Thanks in advance.