Stan Math Library  2.8.0
reverse mode automatic differentiation
 All Classes Namespaces Files Functions Variables Typedefs Enumerator Friends Macros Groups
check_row_index.hpp
Go to the documentation of this file.
1 #ifndef STAN_MATH_PRIM_MAT_ERR_CHECK_ROW_INDEX_HPP
2 #define STAN_MATH_PRIM_MAT_ERR_CHECK_ROW_INDEX_HPP
3 
6 
7 #include <sstream>
8 #include <string>
9 
10 namespace stan {
11  namespace math {
12 
31  template <typename T_y, int R, int C>
32  inline bool check_row_index(const char* function,
33  const char* name,
34  const Eigen::Matrix<T_y, R, C>& y,
35  size_t i) {
37  && i < static_cast<size_t>(y.rows()) + stan::error_index::value)
38  return true;
39 
40  std::stringstream msg;
41  msg << " for rows of " << name;
42  std::string msg_str(msg.str());
43  out_of_range(function,
44  y.rows(),
45  i,
46  msg_str.c_str());
47  return false;
48  }
49 
50  }
51 }
52 #endif
bool check_row_index(const char *function, const char *name, const Eigen::Matrix< T_y, R, C > &y, size_t i)
Return true if the specified index is a valid row of the matrix.
void out_of_range(const char *function, const int max, const int index, const char *msg1="", const char *msg2="")
Throw an out_of_range exception with a consistently formatted message.

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