1 #ifndef STAN_MATH_PRIM_FUN_ZEROS_VECTOR_HPP 2 #define STAN_MATH_PRIM_FUN_ZEROS_VECTOR_HPP 3 4 #include <stan/math/prim/err.hpp> 5 #include <stan/math/prim/fun/Eigen.hpp> 6 7 namespace stan { 8 namespace math { 9 10 /** 11 * Return a vector of zeros. 12 * 13 * @param K size of the vector 14 * @return A vector of size K with all elements initialised to 0. 15 * @throw std::domain_error if K is negative. 16 */ zeros_vector(int K)17inline auto zeros_vector(int K) { 18 check_nonnegative("zeros_vector", "size", K); 19 return Eigen::VectorXd::Zero(K); 20 } 21 22 } // namespace math 23 } // namespace stan 24 25 #endif 26