Stan Math Library  2.20.0
reverse mode automatic differentiation
rep_vector.hpp
Go to the documentation of this file.
1 #ifndef STAN_MATH_PRIM_MAT_FUN_REP_VECTOR_HPP
2 #define STAN_MATH_PRIM_MAT_FUN_REP_VECTOR_HPP
3 
4 #include <boost/math/tools/promotion.hpp>
7 
8 namespace stan {
9 namespace math {
10 
11 template <typename T>
12 inline Eigen::Matrix<typename boost::math::tools::promote_args<T>::type,
13  Eigen::Dynamic, 1>
14 rep_vector(const T& x, int n) {
15  check_nonnegative("rep_vector", "n", n);
16  return Eigen::Matrix<typename boost::math::tools::promote_args<T>::type,
17  Eigen::Dynamic, 1>::Constant(n, x);
18 }
19 
20 } // namespace math
21 } // namespace stan
22 
23 #endif
Eigen::Matrix< typename boost::math::tools::promote_args< T >::type, Eigen::Dynamic, 1 > rep_vector(const T &x, int n)
Definition: rep_vector.hpp:14
void check_nonnegative(const char *function, const char *name, const T_y &y)
Check if y is non-negative.

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