You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

18 lines
516 B

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