1 #ifndef STAN_MATH_PRIM_FUN_ROW_HPP 2 #define STAN_MATH_PRIM_FUN_ROW_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 the specified row of the specified matrix, using 12 * start-at-1 indexing. 13 * 14 * This is equivalent to calling <code>m.row(i - 1)</code> and 15 * assigning the resulting template expression to a row vector. 16 * 17 * @tparam T type of the matrix 18 * @param m Matrix. 19 * @param i Row index (count from 1). 20 * @return Specified row of the matrix. 21 * @throw std::out_of_range if i is out of range. 22 */ 23 template <typename T, require_matrix_t<T>* = nullptr> row(const T & m,size_t i)24inline auto row(const T& m, size_t i) { 25 check_row_index("row", "i", m, i); 26 27 return m.row(i - 1); 28 } 29 30 } // namespace math 31 } // namespace stan 32 33 #endif 34