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.

22 lines
471 B

  1. #include <iostream>
  2. #include <Eigen/Dense>
  3. using namespace Eigen;
  4. int main()
  5. {
  6. Matrix2d a;
  7. a << 1, 2,
  8. 3, 4;
  9. MatrixXd b(2,2);
  10. b << 2, 3,
  11. 1, 4;
  12. std::cout << "a + b =\n" << a + b << std::endl;
  13. std::cout << "a - b =\n" << a - b << std::endl;
  14. std::cout << "Doing a += b;" << std::endl;
  15. a += b;
  16. std::cout << "Now a =\n" << a << std::endl;
  17. Vector3d v(1,2,3);
  18. Vector3d w(1,0,0);
  19. std::cout << "-v + w - v =\n" << -v + w - v << std::endl;
  20. }