| Stan Math Library 2.11.0 reverse mode automatic differentiation

- Main Page
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

promote_scalar.hpp
Go to the documentation of this file.
1 #ifndef STAN_MATH_PRIM_ARR_FUN_PROMOTE_SCALAR_HPP
2 #define STAN_MATH_PRIM_ARR_FUN_PROMOTE_SCALAR_HPP
3
4 #include <stan/math/prim/scal/fun/promote_scalar.hpp>
5 #include <stan/math/prim/scal/fun/promote_scalar_type.hpp>
6 #include <stan/math/prim/arr/meta/index_type.hpp>
7 #include <vector>
8
9 namespace stan {
10 namespace math {
11
21 template <typename T, typename S>
22 struct promote_scalar_struct<T, std::vector<S> > {
31 static std::vector<typename promote_scalar_type<T, S>::type>
32 apply(const std::vector<S>& x) {
33 typedef std::vector<typename promote_scalar_type<T, S>::type> return_t;
34 typedef typename index_type<return_t>::type idx_t;
35 return_t y(x.size());
36 for (idx_t i = 0; i < x.size(); ++i)
37 y[i] = promote_scalar_struct<T, S>::apply(x[i]);
38 return y;
39 }
40 };
41
42 }
43 }
44 #endif
stan
Definition: log_sum_exp.hpp:8
index_type.hpp
std
Definition: std_numeric_limits.hpp:7
stan::math::promote_scalar_struct< T, std::vector< S > >::apply
static std::vector< typename promote_scalar_type< T, S >::type > apply(const std::vector< S > &x)
Return the standard vector consisting of the recursive promotion of the elements of the input standar...
Definition: promote_scalar.hpp:32
stan::math::index_type
Primary template class for the metaprogram to compute the index type of a container.
Definition: index_type.hpp:19
stan::math::promote_scalar_struct
General struct to hold static function for promoting underlying scalar types.
Definition: promote_scalar.hpp:19
promote_scalar_type.hpp
promote_scalar.hpp

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