Stan  2.5.0
probability, sampling & optimization
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
check_column_index.hpp
Go to the documentation of this file.
1 #ifndef STAN__MATH__ERROR_HANDLING__MATRIX__CHECK_COLUMN_INDEX_HPP
2 #define STAN__MATH__ERROR_HANDLING__MATRIX__CHECK_COLUMN_INDEX_HPP
3 
4 #include <sstream>
7 
8 namespace stan {
9  namespace math {
10 
24  template <typename T_y, typename T_result, int R, int C>
25  inline bool check_column_index(const char* function,
26  size_t i,
27  const Eigen::Matrix<T_y,R,C>& y,
28  const char* name,
29  T_result* result) {
30  if ((i > 0) && (i <= static_cast<size_t>(y.cols())))
31  return true;
32 
33  std::ostringstream msg;
34  msg << name << " (%1%) must be greater than 0 and less than "
35  << y.cols();
36  std::string tmp(msg.str());
37  return dom_err(function,i,name,
38  tmp.c_str(),"",
39  result);
40  }
41 
42  }
43 }
44 #endif
bool dom_err(const char *function, const T &y, const char *name, const char *error_msg, const T_msg error_msg2, T_result *result)
Definition: dom_err.hpp:36
bool check_column_index(const char *function, size_t i, const Eigen::Matrix< T_y, R, C > &y, const char *name, T_result *result)
Return true if the specified index is a valid column of the matrix.

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