tut_arithmetic_dot_cross.cpp File Reference

Go to the source code of this file.

Functions

int main ()
 

Function Documentation

◆ main()

int main ( )

Definition at line 4 of file tut_arithmetic_dot_cross.cpp.

5 {
6  Eigen::Vector3d v(1,2,3);
7  Eigen::Vector3d w(0,1,2);
8 
9  std::cout << "Dot product: " << v.dot(w) << std::endl;
10  double dp = v.adjoint()*w; // automatic conversion of the inner product to a scalar
11  std::cout << "Dot product via a matrix product: " << dp << std::endl;
12 
13  std::cout << "Cross product:\n" << v.cross(w) << std::endl;
14  Eigen::Vector2d v2(1,2);
15  Eigen::Vector2d w2(0,1);
16  double cp = v2.cross(w2); // returning a scalar between size-2 vectors
17  std::cout << "Cross product for 2D vectors: " << cp << std::endl;
18 }
Array< int, Dynamic, 1 > v
RowVector3d w
Map< RowVectorXf > v2(M2.data(), M2.size())
The matrix class, also used for vectors and row-vectors.
Definition: Matrix.h:182