1 |
|
|
// |
2 |
|
|
// Copyright (c) 2018-2019 INRIA |
3 |
|
|
// |
4 |
|
|
|
5 |
|
|
#ifndef __pinocchio_math_taylor_expansion_hpp__ |
6 |
|
|
#define __pinocchio_math_taylor_expansion_hpp__ |
7 |
|
|
|
8 |
|
|
#include "pinocchio/math/fwd.hpp" |
9 |
|
|
#include <limits> |
10 |
|
|
|
11 |
|
|
namespace pinocchio |
12 |
|
|
{ |
13 |
|
|
|
14 |
|
|
/// |
15 |
|
|
/// \brief Helper struct to retrieve some useful information for a Taylor series |
16 |
|
|
/// expansion according to the a given Scalar type. |
17 |
|
|
/// |
18 |
|
|
/// \tparam Scalar the Scalar type of the Taylor series expansion. |
19 |
|
|
/// |
20 |
|
|
template<typename Scalar> |
21 |
|
|
struct TaylorSeriesExpansion |
22 |
|
|
{ |
23 |
|
|
/// |
24 |
|
|
/// \brief Computes the expected tolerance of the argument of a Taylor series expansion for a certain degree |
25 |
|
|
/// according to the machine precision of the given input Scalar. |
26 |
|
|
/// |
27 |
|
|
/// \tparam degree the degree of the Taylor series expansion. |
28 |
|
|
/// |
29 |
|
|
template<int degree> |
30 |
|
240242 |
static Scalar precision() |
31 |
|
|
{ |
32 |
✓✓✓✗ ✓✗✗✗
|
240242 |
static Scalar value = math::pow(std::numeric_limits<Scalar>::epsilon(),Scalar(1)/Scalar(degree+1)); |
33 |
|
240242 |
return value; |
34 |
|
|
} |
35 |
|
|
}; // struct TaylorSeriesExpansion |
36 |
|
|
|
37 |
|
|
} |
38 |
|
|
|
39 |
|
|
#endif // ifndef __pinocchio_math_taylor_expansion_hpp__ |