1 #define EIGEN2_SUPPORT 2 #include <Eigen/Core> 3 #include <iostream> 4 5 using namespace Eigen; 6 using namespace std; 7 8 int main() 9 { 10 Matrix3i m = Matrix3i::Random(); 11 cout << "Here is the matrix m:" << endl << m << endl; 12 Matrix3i n = Matrix3i::Random(); 13 cout << "And here is the matrix n:" << endl << n << endl; 14 cout << "The coefficient-wise product of m and n is:" << endl; 15 cout << m.cwise() * n << endl; 16 cout << "Taking the cube of the coefficients of m yields:" << endl; 17 cout << m.cwise().pow(3) << endl; 18 } 19