Eigen 3.4.90
Main Page
Related Pages
Modules
Classes
Class List
Class Hierarchy
Class Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Variables
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
Typedefs
_
a
b
c
d
e
f
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
Enumerations
Enumerator
a
b
c
d
e
f
h
i
k
m
n
o
p
q
r
s
t
u
v
Related Functions
o
Files
File List
File Members
All
_
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
a
b
c
d
e
f
g
h
i
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Variables
a
b
c
d
e
g
h
i
j
l
m
n
o
p
q
r
s
t
v
w
x
y
Typedefs
a
b
c
d
e
f
i
l
m
n
r
s
t
u
Macros
_
a
b
c
d
e
f
g
h
l
m
p
s
u
v
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Modules
Pages
doc
examples
tut_arithmetic_dot_cross.cpp
Go to the documentation of this file.
1
#include <iostream>
2
#include <
Eigen/Dense
>
3
4
int
main
()
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
}
v
Array< int, Dynamic, 1 > v
Definition:
Array_initializer_list_vector_cxx11.cpp:1
Dense
w
RowVector3d w
Definition:
Matrix_resize_int.cpp:3
v2
Map< RowVectorXf > v2(M2.data(), M2.size())
Eigen::Matrix
The matrix class, also used for vectors and row-vectors.
Definition:
Matrix.h:182
main
int main()
Definition:
tut_arithmetic_dot_cross.cpp:4
Code