| Stan Math Library 2.11.0 reverse mode automatic differentiation

- Main Page
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

check_positive_size.hpp
Go to the documentation of this file.
1 #ifndef STAN_MATH_PRIM_SCAL_ERR_CHECK_POSITIVE_SIZE_HPP
2 #define STAN_MATH_PRIM_SCAL_ERR_CHECK_POSITIVE_SIZE_HPP
3
4 #include <stan/math/prim/scal/err/invalid_argument.hpp>
5 #include <sstream>
6 #include <string>
7
8 namespace stan {
9 namespace math {
10
23 inline bool check_positive_size(const char* function,
24 const char* name,
25 const char* expr,
26 const int size) {
27 if (size <= 0) {
28 std::stringstream msg;
29 msg << "; dimension size expression = " << expr;
30 std::string msg_str(msg.str());
31 invalid_argument(function, name, size,
32 "must have a positive size, but is ",
33 msg_str.c_str());
34 }
35 return true;
36 }
37
38 }
39 }
40 #endif
stan::math::check_positive_size
bool check_positive_size(const char *function, const char *name, const char *expr, const int size)
Return true if size is positive.
Definition: check_positive_size.hpp:23
stan
Definition: log_sum_exp.hpp:8
invalid_argument.hpp
stan::math::invalid_argument
void invalid_argument(const char *function, const char *name, const T &y, const char *msg1, const char *msg2)
Throw an invalid_argument exception with a consistently formatted message.
Definition: invalid_argument.hpp:31
stan::math::size
int size(const std::vector< T > &x)
Return the size of the specified standard vector.
Definition: size.hpp:17

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