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