Stan Math Library  2.14.0
reverse mode automatic differentiation
ad_promotable.hpp
Go to the documentation of this file.
1 #ifndef STAN_MATH_PRIM_SCAL_META_AD_PROMOTABLE_HPP
2 #define STAN_MATH_PRIM_SCAL_META_AD_PROMOTABLE_HPP
3 
4 namespace stan {
5  namespace math {
6 
19  template <typename V, typename T>
20  struct ad_promotable {
21  enum { value = false };
22  };
23 
29  template <typename T>
30  struct ad_promotable<T, T> {
31  enum { value = true };
32  };
33 
37  template <>
38  struct ad_promotable<long double, double> {
39  enum { value = true };
40  };
41 
45  template <>
46  struct ad_promotable<double, double> {
47  enum { value = true };
48  };
49 
53  template <>
54  struct ad_promotable<float, double> {
55  enum { value = true };
56  };
57 
61  template <>
62  struct ad_promotable<long, double> { // NOLINT(runtime/int)
63  enum { value = true };
64  };
65 
69  template <>
70  struct ad_promotable<int, double> {
71  enum { value = true };
72  };
73 
77  template <>
78  struct ad_promotable<short, double> { // NOLINT(runtime/int)
79  enum { value = true };
80  };
81 
85  template <>
86  struct ad_promotable<char, double> {
87  enum { value = true };
88  };
89 
93  template <>
94  struct ad_promotable<bool, double> {
95  enum { value = true };
96  };
97 
101  template <>
102  struct ad_promotable<unsigned long, double> { // NOLINT(runtime/int)
103  enum { value = true };
104  };
105 
109  template <>
110  struct ad_promotable<unsigned int, double> {
111  enum { value = true };
112  };
113 
117  template <>
118  struct ad_promotable<unsigned short, double> { // NOLINT(runtime/int)
119  enum { value = true };
120  };
121 
125  template <>
126  struct ad_promotable<unsigned char, double> {
127  enum { value = true };
128  };
129 
130  }
131 }
132 #endif
Template traits metaprogram to determine if a variable of one template type can be promoted to a seco...

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