Main Page
Related Pages
Modules
Namespaces
Namespace List
Namespace 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
y
z
Typedefs
_
a
b
c
d
e
f
g
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
y
Enumerations
a
c
d
e
f
g
i
k
l
m
n
p
q
r
s
t
u
Enumerator
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
x
z
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
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Enumerations
a
b
c
d
f
k
l
m
n
o
p
r
s
t
v
z
Enumerator
_
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
Related Functions
:
a
b
c
d
e
g
h
i
l
m
n
o
p
r
s
t
u
v
Files
File List
File 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
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
x
z
Enumerations
Enumerator
b
c
e
f
g
i
l
m
n
o
p
r
s
t
u
v
x
y
z
Macros
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Examples
gtsam
3rdparty
Eigen
bench
quatmul.cpp
Go to the documentation of this file.
1
#include <iostream>
2
#include <Eigen/Core>
3
#include <Eigen/Geometry>
4
#include <
bench/BenchTimer.h
>
5
6
using namespace
Eigen
;
7
8
template
<
typename
Quat>
9
EIGEN_DONT_INLINE
void
quatmul_default
(
const
Quat&
a
,
const
Quat&
b
, Quat&
c
)
10
{
11
c
=
a
*
b
;
12
}
13
14
template
<
typename
Quat>
15
EIGEN_DONT_INLINE
void
quatmul_novec
(
const
Quat&
a
,
const
Quat&
b
, Quat&
c
)
16
{
17
c
=
internal::quat_product<0, Quat, Quat, typename Quat::Scalar, Aligned>::run
(
a
,
b
);
18
}
19
20
template
<
typename
Quat>
void
bench
(
const
std::string& label)
21
{
22
int
tries = 10;
23
int
rep = 1000000;
24
BenchTimer
t
;
25
26
Quat
a
(4, 1, 2, 3);
27
Quat
b
(2, 3, 4, 5);
28
Quat
c
;
29
30
std::cout.precision(3);
31
32
BENCH
(
t
, tries, rep,
quatmul_default
(
a
,
b
,
c
));
33
std::cout << label <<
" default "
<< 1e3*
t
.best(
CPU_TIMER
) <<
"ms \t"
<< 1
e
-6*double(rep)/(
t
.best(
CPU_TIMER
)) <<
" M mul/s\n"
;
34
35
BENCH
(
t
, tries, rep,
quatmul_novec
(
a
,
b
,
c
));
36
std::cout << label <<
" novec "
<< 1e3*
t
.best(
CPU_TIMER
) <<
"ms \t"
<< 1
e
-6*double(rep)/(
t
.best(
CPU_TIMER
)) <<
" M mul/s\n"
;
37
}
38
39
int
main
()
40
{
41
bench<Quaternionf>(
"float "
);
42
bench<Quaterniond>(
"double"
);
43
44
return
0;
45
46
}
47
bench
void bench(const std::string &label)
Definition:
quatmul.cpp:20
Eigen
Namespace containing all symbols from the Eigen library.
Definition:
jet.h:637
e
Array< double, 1, 3 > e(1./3., 0.5, 2.)
c
Scalar Scalar * c
Definition:
benchVecAdd.cpp:17
b
Scalar * b
Definition:
benchVecAdd.cpp:17
quatmul_default
EIGEN_DONT_INLINE void quatmul_default(const Quat &a, const Quat &b, Quat &c)
Definition:
quatmul.cpp:9
Eigen::BenchTimer
Definition:
BenchTimer.h:59
BENCH
#define BENCH(TIMER, TRIES, REP, CODE)
Definition:
BenchTimer.h:174
main
int main()
Definition:
quatmul.cpp:39
Eigen::internal::quat_product::run
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Quaternion< Scalar > run(const QuaternionBase< Derived1 > &a, const QuaternionBase< Derived2 > &b)
Definition:
3rdparty/Eigen/Eigen/src/Geometry/Quaternion.h:493
a
ArrayXXi a
Definition:
Array_initializer_list_23_cxx11.cpp:1
Eigen::CPU_TIMER
@ CPU_TIMER
Definition:
BenchTimer.h:48
BenchTimer.h
align_3::t
Point2 t(10, 10)
quatmul_novec
EIGEN_DONT_INLINE void quatmul_novec(const Quat &a, const Quat &b, Quat &c)
Definition:
quatmul.cpp:15
EIGEN_DONT_INLINE
#define EIGEN_DONT_INLINE
Definition:
Macros.h:940
gtsam
Author(s):
autogenerated on Wed Mar 19 2025 03:03:14