Stan Math Library  2.14.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  namespace math {
10 
11  template <typename T1, typename T2>
12  struct common_type {
13  typedef typename boost::math::tools::promote_args<T1, T2>::type type;
14  };
15 
16  template <typename T1, typename T2>
17  struct common_type<std::vector<T1>, std::vector<T2> > {
18  typedef std::vector<typename common_type<T1, T2>::type> type;
19  };
20 
21  template <typename T1, typename T2, int R, int C>
22  struct common_type<Eigen::Matrix<T1, R, C>, Eigen::Matrix<T2, R, C> > {
23  typedef Eigen::Matrix<typename common_type<T1, T2>::type, R, C> type;
24  };
25 
26  }
27 }
28 
29 #endif
std::vector< typename common_type< T1, T2 >::type > type
Definition: common_type.hpp:18
(Expert) Numerical traits for algorithmic differentiation variables.
Eigen::Matrix< typename common_type< T1, T2 >::type, R, C > type
Definition: common_type.hpp:23
boost::math::tools::promote_args< T1, T2 >::type type
Definition: common_type.hpp:13

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