1 #ifndef STAN_MATH_PRIM_MAT_FUN_SEGMENT_HPP 2 #define STAN_MATH_PRIM_MAT_FUN_SEGMENT_HPP 17 inline Eigen::Matrix<T, Eigen::Dynamic, 1>
segment(
18 const Eigen::Matrix<T, Eigen::Dynamic, 1>& v,
size_t i,
size_t n) {
24 static_cast<size_t>(v.rows()));
26 return v.segment(i - 1, n);
30 inline Eigen::Matrix<T, 1, Eigen::Dynamic>
segment(
31 const Eigen::Matrix<T, 1, Eigen::Dynamic>& v,
size_t i,
size_t n) {
37 static_cast<size_t>(v.cols()));
40 return v.segment(i - 1, n);
44 std::vector<T>
segment(
const std::vector<T>& sv,
size_t i,
size_t n) {
50 static_cast<size_t>(sv.size()));
53 for (
size_t j = 0; j < n; ++j)
54 s.push_back(sv[i + j - 1]);
void check_less_or_equal(const char *function, const char *name, const T_y &y, const T_high &high)
Check if y is less or equal to high.
void check_greater(const char *function, const char *name, const T_y &y, const T_low &low)
Check if y is strictly greater than low.
Eigen::Matrix< T, Eigen::Dynamic, 1 > segment(const Eigen::Matrix< T, Eigen::Dynamic, 1 > &v, size_t i, size_t n)
Return the specified number of elements as a vector starting from the specified element - 1 of the sp...