Stan  1.3
probability, sampling & optimization
 All Classes Namespaces Files Functions Variables Typedefs Enumerator Friends Macros Pages
common_type.hpp
Go to the documentation of this file.
1 #ifndef __STAN__MATH__MATRIX__COMMON_TYPE_HPP__
2 #define __STAN__MATH__MATRIX__COMMON_TYPE_HPP__
3 
4 #include <vector>
6 #include <boost/math/tools/promotion.hpp>
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

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