class_CwiseBinaryOp.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 a custom template binary functor
00007 template<typename Scalar> struct MakeComplexOp {
00008   EIGEN_EMPTY_STRUCT_CTOR(MakeComplexOp)
00009   typedef complex<Scalar> result_type;
00010   complex<Scalar> operator()(const Scalar& a, const Scalar& b) const { return complex<Scalar>(a,b); }
00011 };
00012 
00013 int main(int, char**)
00014 {
00015   Matrix4d m1 = Matrix4d::Random(), m2 = Matrix4d::Random();
00016   cout << m1.binaryExpr(m2, MakeComplexOp<double>()) << endl;
00017   return 0;
00018 }


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