Stan  2.5.0
probability, sampling & optimization
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
promote_scalar.hpp
Go to the documentation of this file.
1 #ifndef STAN__MATH__MATRIX__PROMOTE_SCALAR_HPP
2 #define STAN__MATH__MATRIX__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> > {
22 
31  static Eigen::Matrix<typename promote_scalar_type<T,S>::type, -1,-1>
32  apply(const Eigen::Matrix<S, -1,-1>& x) {
33  Eigen::Matrix<typename promote_scalar_type<T,S>::type, -1,-1>
34  y(x.rows(), x.cols());
35  for (size_t i = 0; i < x.size(); ++i)
37  return y;
38  }
39 
40  };
41 
42 
51  template <typename T, typename S>
52  struct promote_scalar_struct<T, Eigen::Matrix<S,1,-1> > {
53 
62  static Eigen::Matrix<typename promote_scalar_type<T,S>::type, 1,-1>
63  apply(const Eigen::Matrix<S, 1,-1>& x) {
64  Eigen::Matrix<typename promote_scalar_type<T,S>::type, 1,-1>
65  y(x.rows(), x.cols());
66  for (size_t i = 0; i < x.size(); ++i)
68  return y;
69  }
70 
71  };
72 
73 
82  template <typename T, typename S>
83  struct promote_scalar_struct<T, Eigen::Matrix<S,-1,1> > {
84 
93  static Eigen::Matrix<typename promote_scalar_type<T,S>::type, -1,1>
94  apply(const Eigen::Matrix<S, -1,1>& x) {
95  Eigen::Matrix<typename promote_scalar_type<T,S>::type, -1,1>
96  y(x.rows(), x.cols());
97  for (size_t i = 0; i < x.size(); ++i)
99  return y;
100  }
101 
102  };
103 
104 
105  }
106 }
107 
108 
109 #endif
110 
111 
112 
113 
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...
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...
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 matrix consisting of the recursive promotion of the elements of the input matrix to the sc...
static T apply(S x)
Return the value of the input argument promoted to the type specified by the template parameter...

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