I have a do_magic
method which takes a double and adds 42 to it. I'd like to apply this method to each coefficient of a Eigen::Matrix
or Eigen::Array
(that means, I wouldn't mind if it's only possible with one of both types).
Is this possible?
Like this:
Eigen::MatrixXd m(2, 2);
m << 1,2,1,2;
m.applyCoefficientWise(do_magic);
// m is now 43, 44, 43, 44