Stan Math Library  2.15.0
reverse mode automatic differentiation
Eigen_NumTraits.hpp
Go to the documentation of this file.
1 #ifndef STAN_MATH_FWD_MAT_FUN_EIGEN_NUMTRAITS_HPP
2 #define STAN_MATH_FWD_MAT_FUN_EIGEN_NUMTRAITS_HPP
3 
4 #include <stan/math/fwd/core.hpp>
7 #include <limits>
8 
9 namespace Eigen {
10 
15  template <typename T>
16  struct NumTraits<stan::math::fvar<T> >
17  : GenericNumTraits<stan::math::fvar<T> > {
18 
19  enum {
23  RequireInitialization = 1,
24 
28  ReadCost = 2 * NumTraits<double>::ReadCost,
29 
37  AddCost = 2 * NumTraits<T>::AddCost,
38 
46  MulCost = 3 * NumTraits<T>::MulCost + NumTraits<T>::AddCost
47  };
48 
54  static int digits10() {
55  return std::numeric_limits<double>::digits10;
56  }
57  };
58 
59  namespace internal {
60 #if EIGEN_VERSION_AT_LEAST(3, 3, 0)
61 #else
62 
65  template<typename T>
66  struct significant_decimals_default_impl<stan::math::fvar<T>, false> {
67  static inline int run() {
68  using std::ceil;
69  using std::log;
70  return cast<double, int>
71  (ceil(-log(std::numeric_limits<double>::epsilon())
72  / log(10.0)));
73  }
74  };
75 #endif
76  }
77 
78 
79 }
80 #endif
fvar< T > log(const fvar< T > &x)
Definition: log.hpp:14
(Expert) Numerical traits for algorithmic differentiation variables.
static int digits10()
Return the number of decimal digits that can be represented without change.
fvar< T > ceil(const fvar< T > &x)
Definition: ceil.hpp:11

     [ Stan Home Page ] © 2011–2016, Stan Development Team.