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.

15 lines
393 B

  1. #include <iostream>
  2. #include <Eigen/Dense>
  3. using namespace Eigen;
  4. using namespace std;
  5. int main()
  6. {
  7. Vector3d v(1,2,3);
  8. Vector3d w(0,1,2);
  9. cout << "Dot product: " << v.dot(w) << endl;
  10. double dp = v.adjoint()*w; // automatic conversion of the inner product to a scalar
  11. cout << "Dot product via a matrix product: " << dp << endl;
  12. cout << "Cross product:\n" << v.cross(w) << endl;
  13. }