1 #ifndef STAN__MATH__ERROR_HANDLING__CHECK_BOUNDED_HPP
2 #define STAN__MATH__ERROR_HANDLING__CHECK_BOUNDED_HPP
20 template <
typename T_y,
typename T_low,
typename T_high,
typename T_result,
23 static bool check(
const char*
function,
31 typedef std::pair<typename scalar_type<T_low>::type,
36 for (
size_t n = 0; n <
max_size(low, high); n++) {
37 if (!(low_vec[n] <= y && y <= high_vec[n]))
39 " is %1%, but must be between ",
40 pair_type(low_vec[n], high_vec[n]),
47 template <
typename T_y,
51 struct bounded<T_y, T_low, T_high, T_result, true> {
52 static bool check(
const char*
function,
60 typedef std::pair<typename scalar_type<T_low>::type,
65 for (
size_t n = 0; n <
length(y); n++) {
66 if (!(low_vec[n] <=
get(y,n) &&
get(y,n) <= high_vec[n]))
68 " is %1%, but must be between ",
69 pair_type(low_vec[n], high_vec[n]),
78 template <
typename T_y,
typename T_low,
typename T_high,
typename T_result>
87 ::check(
function,y,low,high,name,result);
bool check_bounded(const char *function, const T_y &y, const T_low &low, const T_high &high, const char *name, T_result *result)
bool dom_err(const char *function, const T &y, const char *name, const char *error_msg, const T_msg error_msg2, T_result *result)
scalar_type_helper< is_vector< T >::value, T >::type type
bool dom_err_vec(const size_t i, const char *function, const T &y, const char *name, const char *error_msg, const T_msg error_msg2, T_result *result)
size_t max_size(const T1 &x1, const T2 &x2)
static bool check(const char *function, const T_y &y, const T_low &low, const T_high &high, const char *name, T_result *result)
T get(const T &x, size_t n)
static bool check(const char *function, const T_y &y, const T_low &low, const T_high &high, const char *name, T_result *result)
VectorView is a template metaprogram that takes its argument and allows it to be used like a vector...