Stan  2.5.0
probability, sampling & optimization
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
validate_non_negative_index.hpp
Go to the documentation of this file.
1 #ifndef STAN__MATH__ERROR_HANDLING__MATRIX__VALIDATE_NON_NEGATIVE_INDEX_HPP
2 #define STAN__MATH__ERROR_HANDLING__MATRIX__VALIDATE_NON_NEGATIVE_INDEX_HPP
3 
4 #include <sstream>
5 #include <stdexcept>
6 
7 namespace stan {
8  namespace math {
9 
10  inline
11  void
12  validate_non_negative_index(const std::string& var_name,
13  const std::string& expr,
14  int val) {
15  if (val < 0) {
16  std::stringstream msg;
17  msg << "Found negative dimension size in variable declaration"
18  << "; variable=" << var_name
19  << "; dimension size expression=" << expr
20  << "; expression value=" << val;
21  throw std::invalid_argument(msg.str());
22  }
23  }
24 
25  }
26 }
27 #endif
void validate_non_negative_index(const std::string &var_name, const std::string &expr, int val)

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