GCC Code Coverage Report


Directory: ./
File: include/pinocchio/math/taylor-expansion.hpp
Date: 2025-02-12 21:03:38
Exec Total Coverage
Lines: 4 4 100.0%
Branches: 8 16 50.0%

Line Branch Exec Source
1 //
2 // Copyright (c) 2018-2021 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
25 /// certain degree
26 /// according to the machine precision of the given input Scalar.
27 ///
28 /// \tparam degree the degree of the Taylor series expansion.
29 ///
30 template<int degree>
31 252536 static Scalar precision()
32 {
33
5/11
✓ Branch 0 taken 17 times.
✓ Branch 1 taken 3426 times.
✓ Branch 3 taken 17 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✓ Branch 6 taken 1 times.
✗ Branch 7 not taken.
✓ Branch 10 taken 1 times.
✗ Branch 11 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
252548 static Scalar value =
34
3/5
✓ Branch 1 taken 1 times.
✓ Branch 2 taken 16 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
91 math::pow(std::numeric_limits<Scalar>::epsilon(), Scalar(1) / Scalar(degree + 1));
35 252536 return value;
36 }
37
38 static Scalar precision(const int degree)
39 {
40 return math::pow(std::numeric_limits<Scalar>::epsilon(), Scalar(1) / Scalar(degree + 1));
41 }
42 }; // struct TaylorSeriesExpansion
43
44 } // namespace pinocchio
45
46 #endif // ifndef __pinocchio_math_taylor_expansion_hpp__
47