Stan Math Library  2.15.0
reverse mode automatic differentiation
check_column_index.hpp
Go to the documentation of this file.
1 #ifndef STAN_MATH_PRIM_MAT_ERR_CHECK_COLUMN_INDEX_HPP
2 #define STAN_MATH_PRIM_MAT_ERR_CHECK_COLUMN_INDEX_HPP
3 
7 #include <sstream>
8 #include <string>
9 
10 namespace stan {
11  namespace math {
12 
34  template <typename T_y, int R, int C>
35  inline void check_column_index(const char* function,
36  const char* name,
37  const Eigen::Matrix<T_y, R, C>& y,
38  size_t i) {
40  && i < static_cast<size_t>(y.cols()) + stan::error_index::value)
41  return;
42 
43  std::stringstream msg;
44  msg << " for columns of " << name;
45  std::string msg_str(msg.str());
46  out_of_range(function, y.cols(), i, msg_str.c_str());
47  }
48 
49  }
50 }
51 #endif
void check_column_index(const char *function, const char *name, const Eigen::Matrix< T_y, R, C > &y, size_t i)
Check if the specified index is a valid column of the matrix.
void out_of_range(const char *function, int max, int index, const char *msg1="", const char *msg2="")
Throw an out_of_range exception with a consistently formatted message.

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