promote_scalar.hpp
Go to the documentation of this file.
#ifndef STAN_MATH_PRIM_ARR_FUN_PROMOTE_SCALAR_HPP
#define STAN_MATH_PRIM_ARR_FUN_PROMOTE_SCALAR_HPP
#include <stan/math/prim/scal/fun/promote_scalar.hpp>
#include <stan/math/prim/scal/fun/promote_scalar_type.hpp>
#include <stan/math/prim/arr/meta/index_type.hpp>
#include <vector>
namespace stan {
namespace math {
template <typename T, typename S>
struct promote_scalar_struct<T, std::vector<S> > {
static std::vector<typename promote_scalar_type<T, S>::type>
apply(const std::vector<S>& x) {
typedef std::vector<typename promote_scalar_type<T, S>::type> return_t;
typedef typename index_type<return_t>::type idx_t;
return_t y(x.size());
for (idx_t i = 0; i < x.size(); ++i)
y[i] = promote_scalar_struct<T, S>::apply(x[i]);
return y;
}
};
}
}
#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:18
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.