1 #ifndef STAN_MATH_REV_FUN_REP_ROW_VECTOR_HPP 2 #define STAN_MATH_REV_FUN_REP_ROW_VECTOR_HPP 3 4 #include <stan/math/prim/fun/Eigen.hpp> 5 #include <stan/math/rev/core.hpp> 6 #include <stan/math/rev/meta.hpp> 7 #include <stan/math/prim/err.hpp> 8 #include <stan/math/prim/fun/rep_row_vector.hpp> 9 10 namespace stan { 11 namespace math { 12 13 /** 14 * Overload for `var_value<Vector>`. 15 * @tparam T_ret The user supplied return type. 16 * @tparam T A double or var type 17 * @param x The type to be propogated through the new vector. 18 * @param n The size of the new vector. 19 */ 20 template <typename T_ret, require_var_matrix_t<T_ret>* = nullptr, 21 require_eigen_row_vector_t<value_type_t<T_ret>>* = nullptr> rep_row_vector(var x,int n)22inline auto rep_row_vector(var x, int n) { 23 return make_callback_var(rep_row_vector(x.val(), n), [x](auto& vi) mutable { 24 forward_as<var>(x).adj() += vi.adj().sum(); 25 }); 26 } 27 28 } // namespace math 29 } // namespace stan 30 31 #endif 32