Stan Math Library  2.10.0
reverse mode automatic differentiation
common_type.hpp
Go to the documentation of this file.
1 #ifndef STAN_MATH_PRIM_MAT_FUN_COMMON_TYPE_HPP
2 #define STAN_MATH_PRIM_MAT_FUN_COMMON_TYPE_HPP
3 
5 #include <boost/math/tools/promotion.hpp>
6 #include <vector>
7 
8 namespace stan {
9 
10  namespace math {
11 
12  template <typename T1, typename T2>
13  struct common_type {
14  typedef typename boost::math::tools::promote_args<T1, T2>::type type;
15  };
16 
17  template <typename T1, typename T2>
18  struct common_type<std::vector<T1>, std::vector<T2> > {
19  typedef std::vector<typename common_type<T1, T2>::type> type;
20  };
21 
22  template <typename T1, typename T2, int R, int C>
23  struct common_type<Eigen::Matrix<T1, R, C>, Eigen::Matrix<T2, R, C> > {
24  typedef Eigen::Matrix<typename common_type<T1, T2>::type, R, C> type;
25  };
26 
27  }
28 }
29 
30 
31 #endif
std::vector< typename common_type< T1, T2 >::type > type
Definition: common_type.hpp:19
(Expert) Numerical traits for algorithmic differentiation variables.
Eigen::Matrix< typename common_type< T1, T2 >::type, R, C > type
Definition: common_type.hpp:24
boost::math::tools::promote_args< T1, T2 >::type type
Definition: common_type.hpp:14

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