For the version of Eigen I currently using, there doesn't seem to have a correspondent build-in implementation cwise operation.
However, a customized cwise operation can be achieve using unaryExpr.
Here is a simple example for achieving similar functionality as the sign() in MATLAB.
float sign(float x)
{
if (x > 0)
return 1.0;
else
return -1.0;}
Mat.unaryExpr(std::ptr_fun(sign))
No comments:
Post a Comment