benchmarks
bench-switch.py
Go to the documentation of this file.
1
import
time
# noqa
2
import
timeit
# noqa
3
4
import
numpy
as
np
5
from
IPython
import
get_ipython
6
7
import
eigenpy
8
9
ipython = get_ipython()
10
11
quat = eigenpy.Quaternion()
12
a = [0.0, 0.0, 0.0]
13
14
cmd1 =
"timeit np.array(a)"
15
print
(
"\n"
)
16
print
(cmd1)
17
ipython.magic(cmd1)
18
print
(
"\n"
)
19
20
cmd2 =
"timeit np.matrix(a)"
21
print
(cmd2)
22
ipython.magic(cmd2)
23
print
(
"\n"
)
24
25
cmd4 =
"timeit quat.coeffs()"
26
print
(cmd4)
27
ipython.magic(cmd4)
28
print
(
"\n"
)
29
30
cmd5 =
"timeit np.asmatrix(quat.coeffs())"
31
print
(cmd5)
32
ipython.magic(cmd5)
33
print
(
"\n"
)
34
35
a_matrix = np.matrix(a)
36
cmd6 =
"timeit np.asarray(a_matrix)"
37
print
(cmd6)
38
ipython.magic(cmd6)
39
print
(
"\n"
)
print
void print(const Eigen::SparseMatrix< Scalar, Options > &mat)
Definition:
sparse_matrix.cpp:50
eigenpy
Author(s): Justin Carpentier, Nicolas Mansard
autogenerated on Sat Nov 2 2024 02:14:45