1#ifndef STAN_MATH_PRIM_FUN_GET_BASE1_LHS_HPP
2#define STAN_MATH_PRIM_FUN_GET_BASE1_LHS_HPP
27inline T&
get_base1_lhs(std::vector<T>& x,
size_t i,
const char* error_msg,
29 check_range(
"[]",
"x", x.size(), i, idx, error_msg);
50inline T&
get_base1_lhs(std::vector<std::vector<T> >& x,
size_t i1,
size_t i2,
51 const char* error_msg,
size_t idx) {
52 check_range(
"[]",
"x", x.size(), i1, idx, error_msg);
75 size_t i1,
size_t i2,
size_t i3,
const char* error_msg,
77 check_range(
"[]",
"x", x.size(), i1, idx, error_msg);
101 std::vector<std::vector<std::vector<std::vector<T> > > >& x,
size_t i1,
102 size_t i2,
size_t i3,
size_t i4,
const char* error_msg,
size_t idx) {
103 check_range(
"[]",
"x", x.size(), i1, idx, error_msg);
104 return get_base1_lhs(x[i1 - 1], i2, i3, i4, error_msg, idx + 1);
128 std::vector<std::vector<std::vector<std::vector<std::vector<T> > > > >& x,
129 size_t i1,
size_t i2,
size_t i3,
size_t i4,
size_t i5,
130 const char* error_msg,
size_t idx) {
131 check_range(
"[]",
"x", x.size(), i1, idx, error_msg);
132 return get_base1_lhs(x[i1 - 1], i2, i3, i4, i5, error_msg, idx + 1);
157 std::vector<std::vector<
158 std::vector<std::vector<std::vector<std::vector<T> > > > > >& x,
159 size_t i1,
size_t i2,
size_t i3,
size_t i4,
size_t i5,
size_t i6,
160 const char* error_msg,
size_t idx) {
161 check_range(
"[]",
"x", x.size(), i1, idx, error_msg);
162 return get_base1_lhs(x[i1 - 1], i2, i3, i4, i5, i6, error_msg, idx + 1);
188 std::vector<std::vector<std::vector<
189 std::vector<std::vector<std::vector<std::vector<T> > > > > > >& x,
190 size_t i1,
size_t i2,
size_t i3,
size_t i4,
size_t i5,
size_t i6,
size_t i7,
191 const char* error_msg,
size_t idx) {
192 check_range(
"[]",
"x", x.size(), i1, idx, error_msg);
193 return get_base1_lhs(x[i1 - 1], i2, i3, i4, i5, i6, i7, error_msg, idx + 1);
220 std::vector<std::vector<std::vector<std::vector<
221 std::vector<std::vector<std::vector<std::vector<T> > > > > > > >& x,
222 size_t i1,
size_t i2,
size_t i3,
size_t i4,
size_t i5,
size_t i6,
size_t i7,
223 size_t i8,
const char* error_msg,
size_t idx) {
224 check_range(
"[]",
"x", x.size(), i1, idx, error_msg);
225 return get_base1_lhs(x[i1 - 1], i2, i3, i4, i5, i6, i7, i8, error_msg,
250inline Eigen::Block<Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> >
252 const char* error_msg,
size_t idx) {
253 check_range(
"[]",
"rows of x", x.rows(), m, idx, error_msg);
254 return x.block(m - 1, 0, 1, x.cols());
276 size_t m,
size_t n,
const char* error_msg,
size_t idx) {
277 check_range(
"[]",
"rows of x", x.rows(), m, idx, error_msg);
278 check_range(
"[]",
"cols of x", x.cols(), n, idx + 1, error_msg);
279 return x(m - 1, n - 1);
299 const char* error_msg,
size_t idx) {
300 check_range(
"[]",
"x", x.size(), m, idx, error_msg);
321 const char* error_msg,
size_t idx) {
322 check_range(
"[]",
"x", x.size(), n, idx, error_msg);
T & get_base1_lhs(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.
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.
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...