Stan Math Library  2.20.0
reverse mode automatic differentiation
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 namespace math {
10 
19 template <typename T, typename S>
20 struct promote_scalar_struct<T, Eigen::Matrix<S, -1, -1> > {
29  static Eigen::Matrix<typename promote_scalar_type<T, S>::type, -1, -1> apply(
30  const Eigen::Matrix<S, -1, -1>& x) {
31  Eigen::Matrix<typename promote_scalar_type<T, S>::type, -1, -1> y(x.rows(),
32  x.cols());
33  for (int i = 0; i < x.size(); ++i)
35  return y;
36  }
37 };
38 
47 template <typename T, typename S>
48 struct promote_scalar_struct<T, Eigen::Matrix<S, 1, -1> > {
57  static Eigen::Matrix<typename promote_scalar_type<T, S>::type, 1, -1> apply(
58  const Eigen::Matrix<S, 1, -1>& x) {
59  Eigen::Matrix<typename promote_scalar_type<T, S>::type, 1, -1> y(x.rows(),
60  x.cols());
61  for (int i = 0; i < x.size(); ++i)
63  return y;
64  }
65 };
66 
75 template <typename T, typename S>
76 struct promote_scalar_struct<T, Eigen::Matrix<S, -1, 1> > {
85  static Eigen::Matrix<typename promote_scalar_type<T, S>::type, -1, 1> apply(
86  const Eigen::Matrix<S, -1, 1>& x) {
87  Eigen::Matrix<typename promote_scalar_type<T, S>::type, -1, 1> y(x.rows(),
88  x.cols());
89  for (int i = 0; i < x.size(); ++i)
91  return y;
92  }
93 };
94 
95 } // namespace math
96 } // namespace stan
97 
98 #endif
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...
(Expert) Numerical traits for algorithmic differentiation variables.
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...
General struct to hold static function for promoting underlying scalar types.
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–2018, Stan Development Team.