1 #ifndef STAN_MATH_PRIM_MAT_FUN_GET_BASE1_HPP 2 #define STAN_MATH_PRIM_MAT_FUN_GET_BASE1_HPP 27 inline const T&
get_base1(
const std::vector<T>& x,
size_t i,
28 const char* error_msg,
size_t idx) {
29 check_range(
"[]",
"x", x.size(), i, idx, error_msg);
50 inline const T&
get_base1(
const std::vector<std::vector<T> >& x,
size_t i1,
51 size_t i2,
const char* error_msg,
size_t idx) {
52 check_range(
"[]",
"x", x.size(), i1, idx, error_msg);
53 return get_base1(x[i1 - 1], i2, error_msg, idx + 1);
74 inline const T&
get_base1(
const std::vector<std::vector<std::vector<T> > >& x,
75 size_t i1,
size_t i2,
size_t i3,
76 const char* error_msg,
size_t idx) {
77 check_range(
"[]",
"x", x.size(), i1, idx, error_msg);
78 return get_base1(x[i1 - 1], i2, i3, error_msg, idx + 1);
101 const std::vector<std::vector<std::vector<std::vector<T> > > >& x,
102 size_t i1,
size_t i2,
size_t i3,
size_t i4,
const char* error_msg,
104 check_range(
"[]",
"x", x.size(), i1, idx, error_msg);
105 return get_base1(x[i1 - 1], i2, i3, i4, error_msg, idx + 1);
127 template <
typename T>
130 std::vector<std::vector<std::vector<std::vector<T> > > > >& x,
131 size_t i1,
size_t i2,
size_t i3,
size_t i4,
size_t i5,
132 const char* error_msg,
size_t idx) {
133 check_range(
"[]",
"x", x.size(), i1, idx, error_msg);
134 return get_base1(x[i1 - 1], i2, i3, i4, i5, error_msg, idx + 1);
157 template <
typename T>
159 const std::vector<std::vector<
160 std::vector<std::vector<std::vector<std::vector<T> > > > > >& x,
161 size_t i1,
size_t i2,
size_t i3,
size_t i4,
size_t i5,
size_t i6,
162 const char* error_msg,
size_t idx) {
163 check_range(
"[]",
"x", x.size(), i1, idx, error_msg);
164 return get_base1(x[i1 - 1], i2, i3, i4, i5, i6, error_msg, idx + 1);
188 template <
typename T>
190 const std::vector<std::vector<std::vector<
191 std::vector<std::vector<std::vector<std::vector<T> > > > > > >& x,
192 size_t i1,
size_t i2,
size_t i3,
size_t i4,
size_t i5,
size_t i6,
size_t i7,
193 const char* error_msg,
size_t idx) {
194 check_range(
"[]",
"x", x.size(), i1, idx, error_msg);
195 return get_base1(x[i1 - 1], i2, i3, i4, i5, i6, i7, error_msg, idx + 1);
220 template <
typename T>
222 const std::vector<std::vector<std::vector<std::vector<
223 std::vector<std::vector<std::vector<std::vector<T> > > > > > > >& x,
224 size_t i1,
size_t i2,
size_t i3,
size_t i4,
size_t i5,
size_t i6,
size_t i7,
225 size_t i8,
const char* error_msg,
size_t idx) {
226 check_range(
"[]",
"x", x.size(), i1, idx, error_msg);
227 return get_base1(x[i1 - 1], i2, i3, i4, i5, i6, i7, i8, error_msg, idx + 1);
250 template <
typename T>
252 const Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic>& x,
size_t m,
253 const char* error_msg,
size_t idx) {
254 check_range(
"[]",
"rows of x", x.rows(), m, idx, error_msg);
255 return x.block(m - 1, 0, 1, x.cols());
275 template <
typename T>
277 const Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic>& x,
size_t m,
278 size_t n,
const char* error_msg,
size_t idx) {
279 check_range(
"[]",
"rows of x", x.rows(), m, idx, error_msg);
280 check_range(
"[]",
"cols of x", x.cols(), n, idx + 1, error_msg);
281 return x(m - 1, n - 1);
299 template <
typename T>
300 inline const T&
get_base1(
const Eigen::Matrix<T, Eigen::Dynamic, 1>& x,
301 size_t m,
const char* error_msg,
size_t idx) {
302 check_range(
"[]",
"x", x.size(), m, idx, error_msg);
321 template <
typename T>
322 inline const T&
get_base1(
const Eigen::Matrix<T, 1, Eigen::Dynamic>& x,
323 size_t n,
const char* error_msg,
size_t idx) {
324 check_range(
"[]",
"x", x.size(), n, idx, error_msg);
void check_range(const char *function, const char *name, int max, int index, int nested_level, const char *error_msg)
Check 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...