Go to the documentation of this file.
3 #include <Eigen/Geometry>
13 return Q((
a.coeffs() * (1.0-
t) +
b.coeffs() *
t).normalized());
26 static const Scalar one =
Scalar(1) - dummy_precision<Scalar>();
41 return Q(scale0 *
a.coeffs() + scale1 *
b.coeffs());
72 return Q(scale0 *
a.coeffs() + scale1 *
b.coeffs());
78 if (
T(1) +
x*
x ==
T(1))
146 typedef double RefScalar;
147 typedef float TestScalar;
153 std::cout <<
g_seed <<
"\n";
163 cout <<
"double=>float=>double nlerp eigen legacy(snap) legacy(nlerp) rightway gael's criteria\n";
167 for (
int w=0;
w<rep; ++
w)
170 a.coeffs().setRandom();
172 b.coeffs().setRandom();
177 Qd ar(
a.cast<RefScalar>());
178 Qd br(
b.cast<RefScalar>());
184 cout << std::scientific;
185 for (
int i=0;
i<iters; ++
i)
190 Qf refc = cr.cast<TestScalar>();
199 err[0] = (cr.coeffs()-refc.cast<RefScalar>().coeffs()).norm();
201 for (
int k=0; k<6; ++k)
203 err[k+1] = (
c[k].coeffs()-refc.coeffs()).norm();
206 maxerr = maxerr.cwise().max(err);
209 b = cr.cast<TestScalar>();
214 avgerr /= RefScalar(rep*iters);
215 cout <<
"\n\nAccuracy:\n"
216 <<
" max: " << maxerr.transpose() <<
"\n";
217 cout <<
" avg: " << avgerr.transpose() <<
"\n";
221 a.coeffs().setRandom();
223 b.coeffs().setRandom();
228 #define BENCH(FUNC) {\
230 for(int k=0; k<2; ++k) {\
232 for(int i=0; i<1000000; ++i) \
236 cout << " " << #FUNC << " => \t " << t.value() << "s\n"; \
239 cout <<
"\nSpeed:\n" << std::fixed;
static unsigned int g_seed
Namespace containing all symbols from the Eigen library.
static const double d[K][N]
Jet< T, N > sin(const Jet< T, N > &f)
set noclip points set clip one set noclip two set bar set border lt lw set xdata set ydata set zdata set x2data set y2data set boxwidth set dummy x
Eigen::Triplet< double > T
const EIGEN_DEVICE_FUNC AsinReturnType asin() const
Jet< T, N > acos(const Jet< T, N > &f)
EIGEN_DONT_INLINE Q slerp_legacy(const Q &a, const Q &b, typename Q::Scalar t)
EIGEN_DONT_INLINE Q slerp_eigen(const Q &a, const Q &b, typename Q::Scalar t)
The quaternion class used to represent 3D orientations and rotations.
EIGEN_DONT_INLINE Q slerp_gael(const Q &a, const Q &b, typename Q::Scalar t)
EIGEN_DONT_INLINE Q slerp_legacy_nlerp(const Q &a, const Q &b, typename Q::Scalar t)
EIGEN_DONT_INLINE Q nlerp(const Q &a, const Q &b, typename Q::Scalar t)
The matrix class, also used for vectors and row-vectors.
EIGEN_DEVICE_FUNC Matrix< _Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols > & setZero(Index size)
EIGEN_DONT_INLINE Q slerp_rw(const Q &a, const Q &b, typename Q::Scalar t)
#define EIGEN_DONT_INLINE
gtsam
Author(s):
autogenerated on Sat Nov 16 2024 04:03:54