Stan Math Library  2.6.3
probability, sampling & optimization
 All Classes Namespaces Files Functions Variables Typedefs Enumerator Friends Macros
promote_scalar.hpp
Go to the documentation of this file.
1 #ifndef STAN_MATH_PRIM_MAT_FUN_PROMOTE_SCALAR_HPP
2 #define STAN_MATH_PRIM_MAT_FUN_PROMOTE_SCALAR_HPP
3 
7 
8 namespace stan {
9 
10  namespace math {
11 
20  template <typename T, typename S>
21  struct promote_scalar_struct<T, Eigen::Matrix<S, -1, -1> > {
30  static Eigen::Matrix<typename promote_scalar_type<T, S>::type, -1, -1>
31  apply(const Eigen::Matrix<S, -1, -1>& x) {
32  Eigen::Matrix<typename promote_scalar_type<T, S>::type, -1, -1>
33  y(x.rows(), x.cols());
34  for (int i = 0; i < x.size(); ++i)
36  return y;
37  }
38  };
39 
40 
49  template <typename T, typename S>
50  struct promote_scalar_struct<T, Eigen::Matrix<S, 1, -1> > {
59  static Eigen::Matrix<typename promote_scalar_type<T, S>::type, 1, -1>
60  apply(const Eigen::Matrix<S, 1, -1>& x) {
61  Eigen::Matrix<typename promote_scalar_type<T, S>::type, 1, -1>
62  y(x.rows(), x.cols());
63  for (int i = 0; i < x.size(); ++i)
65  return y;
66  }
67  };
68 
69 
78  template <typename T, typename S>
79  struct promote_scalar_struct<T, Eigen::Matrix<S, -1, 1> > {
88  static Eigen::Matrix<typename promote_scalar_type<T, S>::type, -1, 1>
89  apply(const Eigen::Matrix<S, -1, 1>& x) {
90  Eigen::Matrix<typename promote_scalar_type<T, S>::type, -1, 1>
91  y(x.rows(), x.cols());
92  for (int i = 0; i < x.size(); ++i)
94  return y;
95  }
96  };
97 
98 
99  }
100 }
101 
102 
103 #endif
104 
105 
106 
107 
General struct to hold static function for promoting underlying scalar types.
static Eigen::Matrix< typename promote_scalar_type< T, S >::type, 1,-1 > apply(const Eigen::Matrix< S, 1,-1 > &x)
Return the column vector consisting of the recursive promotion of the elements of the input column ve...
static T apply(S x)
Return the value of the input argument promoted to the type specified by the template parameter...
static Eigen::Matrix< typename promote_scalar_type< T, S >::type,-1,-1 > apply(const Eigen::Matrix< S,-1,-1 > &x)
Return the matrix consisting of the recursive promotion of the elements of the input matrix to the sc...
static Eigen::Matrix< typename promote_scalar_type< T, S >::type,-1, 1 > apply(const Eigen::Matrix< S,-1, 1 > &x)
Return the row vector consisting of the recursive promotion of the elements of the input row vector t...

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