class_CwiseUnaryOp_ptrfun.cpp
Go to the documentation of this file.
00001 #include <Eigen/Core>
00002 #include <iostream>
00003 using namespace Eigen;
00004 using namespace std;
00005 
00006 // define function to be applied coefficient-wise
00007 double ramp(double x)
00008 {
00009   if (x > 0)
00010     return x;
00011   else 
00012     return 0;
00013 }
00014 
00015 int main(int, char**)
00016 {
00017   Matrix4d m1 = Matrix4d::Random();
00018   cout << m1 << endl << "becomes: " << endl << m1.unaryExpr(ptr_fun(ramp)) << endl;
00019   return 0;
00020 }


re_vision
Author(s): Dorian Galvez-Lopez
autogenerated on Sun Jan 5 2014 11:30:55