1 #ifndef STAN_MATH_PRIM_MAT_FUN_GET_BASE1_HPP
2 #define STAN_MATH_PRIM_MAT_FUN_GET_BASE1_HPP
30 const char* error_msg,
32 check_range(
"[]",
"x", x.size(), i, idx, error_msg);
57 const char* error_msg,
59 check_range(
"[]",
"x", x.size(), i1, idx, error_msg);
60 return get_base1(x[i1 - 1], i2, error_msg, idx+1);
82 get_base1(
const std::vector<std::vector<std::vector<T> > >& x,
86 const char* error_msg,
88 check_range(
"[]",
"x", x.size(), i1, idx, error_msg);
89 return get_base1(x[i1 - 1], i2, i3, error_msg, idx+1);
110 template <
typename T>
112 get_base1(
const std::vector<std::vector<std::vector<std::vector<T> > > >& x,
117 const char* error_msg,
119 check_range(
"[]",
"x", x.size(), i1, idx, error_msg);
120 return get_base1(x[i1 - 1], i2, i3, i4, error_msg, idx+1);
142 template <
typename T>
144 get_base1(
const std::vector<std::vector<std::vector<std::vector
145 <std::vector<T> > > > >& x,
151 const char* error_msg,
153 check_range(
"[]",
"x", x.size(), i1, idx, error_msg);
154 return get_base1(x[i1 - 1], i2, i3, i4, i5, error_msg, idx+1);
177 template <
typename T>
179 get_base1(
const std::vector<std::vector<std::vector<std::vector
180 <std::vector<std::vector<T> > > > > >& x,
187 const char* error_msg,
189 check_range(
"[]",
"x", x.size(), i1, idx, error_msg);
190 return get_base1(x[i1 - 1], i2, i3, i4, i5, i6, error_msg, idx+1);
214 template <
typename T>
216 get_base1(
const std::vector<std::vector<std::vector<std::vector
217 <std::vector<std::vector<std::vector<T> > > > > > >& x,
225 const char* error_msg,
227 check_range(
"[]",
"x", x.size(), i1, idx, error_msg);
228 return get_base1(x[i1 - 1], i2, i3, i4, i5, i6, i7, error_msg, idx+1);
253 template <
typename T>
256 <std::vector<std::vector<std::vector
257 <std::vector<std::vector<T> > > > > > > >& x,
266 const char* error_msg,
268 check_range(
"[]",
"x", x.size(), i1, idx, error_msg);
269 return get_base1(x[i1 - 1], i2, i3, i4, i5, i6, i7, i8, error_msg, idx+1);
292 template <
typename T>
293 inline Eigen::Matrix<T, 1, Eigen::Dynamic>
294 get_base1(
const Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic>& x,
296 const char* error_msg,
298 check_range(
"[]",
"rows of x", x.rows(), m, idx, error_msg);
299 return x.block(m-1, 0, 1, x.cols());
319 template <
typename T>
321 get_base1(
const Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic>& x,
324 const char* error_msg,
326 check_range(
"[]",
"rows of x", x.rows(), m, idx, error_msg);
327 check_range(
"[]",
"cols of x", x.cols(), n, idx + 1, error_msg);
328 return x(m - 1, n - 1);
346 template <
typename T>
348 const T&
get_base1(
const Eigen::Matrix<T, Eigen::Dynamic, 1>& x,
350 const char* error_msg,
352 check_range(
"[]",
"x", x.size(), m, idx, error_msg);
371 template <
typename T>
375 const char* error_msg,
377 check_range(
"[]",
"x", x.size(), n, idx, error_msg);
bool check_range(const char *function, const char *name, const int max, const int index, const int nested_level, const char *error_msg)
Return true if specified index is within range.
const T & get_base1(const std::vector< T > &x, size_t i, const char *error_msg, size_t idx)
Return a reference to the value of the specified vector at the specified base-one index...