1 #ifndef STAN_MATH_PRIM_FUN_AS_VALUE_COLUMN_ARRAY_OR_SCALAR 2 #define STAN_MATH_PRIM_FUN_AS_VALUE_COLUMN_ARRAY_OR_SCALAR 3 4 #include <stan/math/prim/fun/Eigen.hpp> 5 #include <stan/math/prim/meta.hpp> 6 #include <stan/math/prim/fun/as_column_vector_or_scalar.hpp> 7 #include <stan/math/prim/fun/as_array_or_scalar.hpp> 8 #include <stan/math/prim/fun/value_of.hpp> 9 #include <vector> 10 11 namespace stan { 12 namespace math { 13 14 /** 15 * Extract the value from an object and for eigen vectors and `std::vectors` 16 * convert to an eigen column array and for scalars return a scalar. 17 * @tparam T A stan scalar, eigen vector, or `std::vector`. 18 * @param a Specified scalar. 19 * @return the scalar. 20 */ 21 template <typename T> as_value_column_array_or_scalar(T && a)22inline auto as_value_column_array_or_scalar(T&& a) { 23 return value_of( 24 as_array_or_scalar(as_column_vector_or_scalar(std::forward<T>(a)))); 25 } 26 27 } // namespace math 28 } // namespace stan 29 30 #endif 31