Stan Math Library: stan/math/fwd/mat/fun/Eigen_NumTraits.hpp Source File

| Stan Math Library 2.10.0 reverse mode automatic differentiation

- Main Page
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

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>
5 #include <stan/math/prim/mat/fun/Eigen.hpp>
6 #include <limits>
7
8 namespace Eigen {
9
14 template <typename T>
15 struct NumTraits<stan::math::fvar<T> > {
21 typedef stan::math::fvar<T> Real;
22
28 typedef stan::math::fvar<T> NonInteger;
29
35 typedef stan::math::fvar<T> Nested;
36
43 inline static Real epsilon() {
44 return std::numeric_limits<double>::epsilon();
45 }
46
50 inline static Real dummy_precision() {
51 return 1e-12; // copied from NumTraits.h values for double
52 }
53
60 inline static Real highest() {
61 return std::numeric_limits<double>::max();
62 }
63
70 inline static Real lowest() {
71 return -std::numeric_limits<double>::max();
72 }
73
78 enum {
79 IsInteger = 0,
80 IsSigned = 1,
81 IsComplex = 0,
82 RequireInitialization = 1,
83 ReadCost = 1,
84 AddCost = 1,
85 MulCost = 1,
86 HasFloatingPoint = 1
87 };
88 };
89
90 namespace internal {
94 template<typename T>
95 struct significant_decimals_default_impl<stan::math::fvar<T>, false> {
96 static inline int run() {
97 using std::ceil;
98 using std::log;
99 return cast<double, int>
100 (ceil(-log(std::numeric_limits<double>::epsilon())
101 / log(10.0)));
102 }
103 };
104
105 }
106 }
107
108 #endif
Eigen::NumTraits< stan::math::fvar< T > >::NonInteger
stan::math::fvar< T > NonInteger
Non-integer valued variables.
Definition: Eigen_NumTraits.hpp:28
core.hpp
stan
Definition: log_sum_exp.hpp:8
Eigen::internal::significant_decimals_default_impl< stan::math::fvar< T >, false >::run
static int run()
Definition: Eigen_NumTraits.hpp:96
stan::math::log
fvar< T > log(const fvar< T > &x)
Definition: log.hpp:15
Eigen
(Expert) Numerical traits for algorithmic differentiation variables.
Definition: Eigen_NumTraits.hpp:8
Eigen::NumTraits< stan::math::fvar< T > >::dummy_precision
static Real dummy_precision()
Return dummy precision.
Definition: Eigen_NumTraits.hpp:50
Eigen::NumTraits< stan::math::fvar< T > >::highest
static Real highest()
Return standard library's highest for double-precision floating point, std::numeric_limitsmax...
Definition: Eigen_NumTraits.hpp:60
Eigen::NumTraits< stan::math::fvar< T > >::lowest
static Real lowest()
Return standard library's lowest for double-precision floating point, -std::numeric_limitsmax...
Definition: Eigen_NumTraits.hpp:70
Eigen::NumTraits< stan::math::fvar< T > >::Real
stan::math::fvar< T > Real
Real-valued variables.
Definition: Eigen_NumTraits.hpp:21
Eigen::NumTraits< stan::math::fvar< T > >::Nested
stan::math::fvar< T > Nested
Nested variables.
Definition: Eigen_NumTraits.hpp:35
Eigen.hpp
stan::math::max
int max(const std::vector< int > &x)
Returns the maximum coefficient in the specified column vector.
Definition: max.hpp:21
stan::math::e
double e()
Return the base of the natural logarithm.
Definition: constants.hpp:95
Eigen::NumTraits< stan::math::fvar< T > >::epsilon
static Real epsilon()
Return standard library's epsilon for double-precision floating point, std::numeric_limits::e...
Definition: Eigen_NumTraits.hpp:43
stan::math::ceil
fvar< T > ceil(const fvar< T > &x)
Definition: ceil.hpp:11
stan::math::fvar
Definition: fvar.hpp:13

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