Automatic Differentiation
 
Loading...
Searching...
No Matches
validate_positive_index.hpp
Go to the documentation of this file.
1#ifndef STAN_MATH_PRIM_ERR_VALIDATE_POSITIVE_INDEX_HPP
2#define STAN_MATH_PRIM_ERR_VALIDATE_POSITIVE_INDEX_HPP
3
5#include <sstream>
6#include <stdexcept>
7#include <string>
8
9namespace stan {
10namespace math {
11
20inline void validate_positive_index(const char* var_name, const char* expr,
21 int val) {
22 if (val < 1) {
23 [&]() STAN_COLD_PATH {
24 std::stringstream msg;
25 msg << "Found dimension size less than one in simplex declaration"
26 << "; variable=" << var_name << "; dimension size expression=" << expr
27 << "; expression value=" << val;
28 std::string msg_str(msg.str());
29 throw std::invalid_argument(msg_str.c_str());
30 }();
31 }
32}
33
34} // namespace math
35} // namespace stan
36#endif
#define STAN_COLD_PATH
void validate_positive_index(const char *var_name, const char *expr, int val)
Check that simplex is at least size 1.
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...