Stan Math Library  2.20.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>> : GenericNumTraits<stan::math::fvar<T>> {
17  enum {
21  RequireInitialization = 1,
22 
26  ReadCost = 2 * NumTraits<double>::ReadCost,
27 
35  AddCost = 2 * NumTraits<T>::AddCost,
36 
44  MulCost = 3 * NumTraits<T>::MulCost + NumTraits<T>::AddCost
45  };
46 
52  static int digits10() { return std::numeric_limits<double>::digits10; }
53 };
54 
55 namespace internal {
56 
61 template <typename T>
62 struct scalar_product_traits<stan::math::fvar<T>, double> {
64 };
65 
70 template <typename T>
71 struct scalar_product_traits<double, stan::math::fvar<T>> {
73 };
74 } // namespace internal
75 
76 } // namespace Eigen
77 #endif
(Expert) Numerical traits for algorithmic differentiation variables.
static int digits10()
Return the number of decimal digits that can be represented without change.
This template class represents scalars used in forward-mode automatic differentiation, which consist of values and directional derivatives of the specified template type.
Definition: fvar.hpp:41

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