1 #ifndef STAN_MATH_PRIM_MAT_FUN_GET_BASE1_HPP
2 #define STAN_MATH_PRIM_MAT_FUN_GET_BASE1_HPP
29 const char* error_msg,
32 check_range(
"[]",
"x", x.size(), i, idx, error_msg);
56 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);
81 get_base1(
const std::vector<std::vector<std::vector<T> > >& x,
85 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);
109 template <
typename T>
111 get_base1(
const std::vector<std::vector<std::vector<std::vector<T> > > >& x,
116 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);
141 template <
typename T>
143 get_base1(
const std::vector<std::vector<std::vector<std::vector
144 <std::vector<T> > > > >& x,
150 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);
176 template <
typename T>
178 get_base1(
const std::vector<std::vector<std::vector<std::vector
179 <std::vector<std::vector<T> > > > > >& x,
186 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,
228 check_range(
"[]",
"x", x.size(), i1, idx, error_msg);
229 return get_base1(x[i1 - 1], i2, i3, i4, i5, i6, i7, error_msg, idx+1);
254 template <
typename T>
257 <std::vector<std::vector<std::vector
258 <std::vector<std::vector<T> > > > > > > >& x,
267 const char* error_msg,
270 check_range(
"[]",
"x", x.size(), i1, idx, error_msg);
271 return get_base1(x[i1 - 1], i2, i3, i4, i5, i6, i7, i8, error_msg, idx+1);
295 template <
typename T>
296 inline Eigen::Matrix<T, 1, Eigen::Dynamic>
297 get_base1(
const Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic>& x,
299 const char* error_msg,
302 check_range(
"[]",
"rows of x", x.rows(), m, idx, error_msg);
303 return x.block(m-1, 0, 1, x.cols());
322 template <
typename T>
324 get_base1(
const Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic>& x,
327 const char* error_msg,
330 check_range(
"[]",
"rows of x", x.rows(), m, idx, error_msg);
331 check_range(
"[]",
"cols of x", x.cols(), n, idx + 1, error_msg);
332 return x(m - 1, n - 1);
349 template <
typename T>
351 const T&
get_base1(
const Eigen::Matrix<T, Eigen::Dynamic, 1>& x,
353 const char* error_msg,
356 check_range(
"[]",
"x", x.size(), m, idx, error_msg);
374 template <
typename T>
378 const char* error_msg,
381 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...