124 typedef double RefScalar;
125 typedef float TestScalar;
130 unsigned int g_seed = (
unsigned int)time(NULL);
131 std::cout <<
g_seed <<
"\n";
141 cout <<
"double=>float=>double nlerp eigen legacy(snap) legacy(nlerp) rightway "
142 " gael's criteria\n";
146 for (
int w = 0;
w < rep; ++
w) {
148 a.coeffs().setRandom();
150 b.coeffs().setRandom();
155 Qd ar(
a.cast<RefScalar>());
156 Qd br(
b.cast<RefScalar>());
160 cout << std::scientific;
161 for (
int i = 0;
i < iters; ++
i) {
165 Qf refc = cr.cast<TestScalar>();
174 err[0] = (cr.coeffs() - refc.cast<RefScalar>().coeffs()).norm();
176 for (
int k = 0;
k < 6; ++
k) {
177 err[
k + 1] = (
c[
k].coeffs() - refc.coeffs()).norm();
180 maxerr = maxerr.cwise().max(err);
183 b = cr.cast<TestScalar>();
188 avgerr /= RefScalar(rep * iters);
189 cout <<
"\n\nAccuracy:\n"
190 <<
" max: " << maxerr.transpose() <<
"\n";
191 cout <<
" avg: " << avgerr.transpose() <<
"\n";
195 a.coeffs().setRandom();
197 b.coeffs().setRandom();
202 #define BENCH(FUNC) \
205 for (int k = 0; k < 2; ++k) { \
207 for (int i = 0; i < 1000000; ++i) FUNC(a, b, s); \
210 cout << " " << #FUNC << " => \t " << t.value() << "s\n"; \
213 cout <<
"\nSpeed:\n" << std::fixed;
RowVector3d w
Definition: Matrix_resize_int.cpp:3
The matrix class, also used for vectors and row-vectors.
Definition: Eigen/Eigen/src/Core/Matrix.h:186
The quaternion class used to represent 3D orientations and rotations.
Definition: Eigen/Eigen/src/Geometry/Quaternion.h:285
static unsigned int g_seed
Definition: main.h:192
int c
Definition: calibrate.py:100
EIGEN_DONT_INLINE Q slerp_legacy(const Q &a, const Q &b, typename Q::Scalar t)
Definition: quat_slerp.cpp:19
EIGEN_DONT_INLINE Q nlerp(const Q &a, const Q &b, typename Q::Scalar t)
Definition: quat_slerp.cpp:9
EIGEN_DONT_INLINE Q slerp_legacy_nlerp(const Q &a, const Q &b, typename Q::Scalar t)
Definition: quat_slerp.cpp:38
EIGEN_DONT_INLINE Q slerp_gael(const Q &a, const Q &b, typename Q::Scalar t)
Definition: quat_slerp.cpp:94
EIGEN_DONT_INLINE Q slerp_rw(const Q &a, const Q &b, typename Q::Scalar t)
Definition: quat_slerp.cpp:72
EIGEN_DONT_INLINE Q slerp_eigen(const Q &a, const Q &b, typename Q::Scalar t)
Definition: quat_slerp.cpp:14