1 #ifndef STAN_MATH_PRIM_FUN_COLS_HPP 2 #define STAN_MATH_PRIM_FUN_COLS_HPP 3 4 #include <stan/math/prim/fun/Eigen.hpp> 5 #include <stan/math/prim/meta.hpp> 6 7 namespace stan { 8 namespace math { 9 10 /** 11 * Return the number of columns in the specified 12 * matrix, vector, or row vector. 13 * 14 * @tparam T type of the matrix 15 * @param[in] m Input matrix, vector, or row vector. 16 * @return Number of columns. 17 */ 18 template <typename T, require_matrix_t<T>* = nullptr> cols(const T & m)19inline Eigen::Index cols(const T& m) { 20 return m.cols(); 21 } 22 23 } // namespace math 24 } // namespace stan 25 26 #endif 27