All Classes Namespaces Files Functions Variables Typedefs Enumerator Friends Macros Groups
get_base1_lhs.hpp
Go to the documentation of this file.
#ifndef STAN_MATH_PRIM_MAT_FUN_GET_BASE1_LHS_HPP
#define STAN_MATH_PRIM_MAT_FUN_GET_BASE1_LHS_HPP
#include <stan/math/prim/mat/fun/Eigen.hpp>
#include <stan/math/prim/mat/err/check_range.hpp>
#include <vector>
namespace stan {
namespace math {
template <typename T>
inline
T& get_base1_lhs(std::vector<T>& x,
size_t i,
const char* error_msg,
size_t idx) {
using stan::math::check_range;
check_range("[]", "x", x.size(), i, idx, error_msg);
return x[i - 1];
}
template <typename T>
inline
T& get_base1_lhs(std::vector<std::vector<T> >& x,
size_t i1,
size_t i2,
const char* error_msg,
size_t idx) {
using stan::math::check_range;
check_range("[]", "x", x.size(), i1, idx, error_msg);
return get_base1_lhs(x[i1 - 1], i2, error_msg, idx+1);
}
template <typename T>
inline
T& get_base1_lhs(std::vector<std::vector<std::vector<T> > >& x,
size_t i1,
size_t i2,
size_t i3,
const char* error_msg,
size_t idx) {
using stan::math::check_range;
check_range("[]", "x", x.size(), i1, idx, error_msg);
return get_base1_lhs(x[i1 - 1], i2, i3, error_msg, idx+1);
}
template <typename T>
inline
T& get_base1_lhs(std::vector<std::vector<std::vector
<std::vector<T> > > >& x,
size_t i1,
size_t i2,
size_t i3,
size_t i4,
const char* error_msg,
size_t idx) {
using stan::math::check_range;
check_range("[]", "x", x.size(), i1, idx, error_msg);
return get_base1_lhs(x[i1 - 1], i2, i3, i4, error_msg, idx+1);
}
template <typename T>
inline
T& get_base1_lhs(std::vector<std::vector<std::vector<std::vector
<std::vector<T> > > > >& x,
size_t i1,
size_t i2,
size_t i3,
size_t i4,
size_t i5,
const char* error_msg,
size_t idx) {
using stan::math::check_range;
check_range("[]", "x", x.size(), i1, idx, error_msg);
return get_base1_lhs(x[i1 - 1], i2, i3, i4, i5, error_msg, idx+1);
}
template <typename T>
inline
T& get_base1_lhs(std::vector<std::vector<std::vector<std::vector
<std::vector<std::vector<T> > > > > >& x,
size_t i1,
size_t i2,
size_t i3,
size_t i4,
size_t i5,
size_t i6,
const char* error_msg,
size_t idx) {
using stan::math::check_range;
check_range("[]", "x", x.size(), i1, idx, error_msg);
return get_base1_lhs(x[i1 - 1], i2, i3, i4, i5, i6, error_msg, idx+1);
}
template <typename T>
inline
T& get_base1_lhs(std::vector<std::vector<std::vector<std::vector
<std::vector<std::vector
<std::vector<T> > > > > > >& x,
size_t i1,
size_t i2,
size_t i3,
size_t i4,
size_t i5,
size_t i6,
size_t i7,
const char* error_msg,
size_t idx) {
using stan::math::check_range;
check_range("[]", "x", x.size(), i1, idx, error_msg);
return get_base1_lhs(x[i1 - 1], i2, i3, i4, i5, i6, i7, error_msg, idx+1);
}
template <typename T>
inline
T& get_base1_lhs(std::vector<std::vector<std::vector<std::vector
<std::vector<std::vector<std::vector
<std::vector<T> > > > > > > >& x,
size_t i1,
size_t i2,
size_t i3,
size_t i4,
size_t i5,
size_t i6,
size_t i7,
size_t i8,
const char* error_msg,
size_t idx) {
using stan::math::check_range;
check_range("[]", "x", x.size(), i1, idx, error_msg);
return get_base1_lhs(x[i1 - 1], i2, i3, i4, i5, i6, i7, i8,
error_msg, idx+1);
}
template <typename T>
inline
Eigen::Block<Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> >
get_base1_lhs(Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic>& x,
size_t m,
const char* error_msg,
size_t idx) {
using stan::math::check_range;
check_range("[]", "rows of x", x.rows(), m, idx, error_msg);
return x.block(m-1, 0, 1, x.cols());
}
template <typename T>
inline
T& get_base1_lhs(Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic>& x,
size_t m,
size_t n,
const char* error_msg,
size_t idx) {
using stan::math::check_range;
check_range("[]", "rows of x", x.rows(), m, idx, error_msg);
check_range("[]", "cols of x", x.cols(), n, idx + 1, error_msg);
return x(m - 1, n - 1);
}
template <typename T>
inline
T& get_base1_lhs(Eigen::Matrix<T, Eigen::Dynamic, 1>& x,
size_t m,
const char* error_msg,
size_t idx) {
using stan::math::check_range;
check_range("[]", "x", x.size(), m, idx, error_msg);
return x(m - 1);
}
template <typename T>
inline
T& get_base1_lhs(Eigen::Matrix<T, 1, Eigen::Dynamic>& x,
size_t n,
const char* error_msg,
size_t idx) {
using stan::math::check_range;
check_range("[]", "x", x.size(), n, idx, error_msg);
return x(n - 1);
}
}
}
#endif
stan::math::check_range
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.
Definition: check_range.hpp:29
Eigen.hpp
stan::math::get_base1_lhs
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...
Definition: get_base1_lhs.hpp:27
check_range.hpp

[ Stan Home Page ] © 2011–2015, Stan Development Team.