1#ifndef STAN_MATH_PRIM_ERR_CHECK_BOUNDED_HPP
2#define STAN_MATH_PRIM_ERR_CHECK_BOUNDED_HPP
24template <
typename T_y,
typename T_low,
typename T_high,
bool y_is_vec>
26 static void check(
const char* function,
const char* name,
const T_y& y,
27 const T_low& low,
const T_high& high) {
30 for (
size_t n = 0; n <
max_size(low, high); n++) {
31 if (!(low_vec[n] <= y && y <= high_vec[n])) {
32 std::stringstream msg;
33 msg <<
", but must be in the interval ";
34 msg <<
"[" << low_vec[n] <<
", " << high_vec[n] <<
"]";
35 std::string msg_str(msg.str());
42template <
typename T_y,
typename T_low,
typename T_high>
44 static void check(
const char* function,
const char* name,
const T_y& y,
45 const T_low& low,
const T_high& high) {
50 std::stringstream msg;
51 msg <<
", but must be in the interval ";
52 msg <<
"[" << low_vec[n] <<
", " << high_vec[n] <<
"]";
53 std::string msg_str(msg.str());
74template <
typename T_y,
typename T_low,
typename T_high>
75inline void check_bounded(
const char* function,
const char* name,
const T_y& y,
76 const T_low& low,
const T_high& high) {
81 function, name, y, low, high);
scalar_seq_view provides a uniform sequence-like wrapper around either a scalar or a sequence of scal...
T get(const T &x, size_t n)
Returns the provided element.
int64_t size(const T &m)
Returns the size (number of the elements) of a matrix_cl or var_value<matrix_cl<T>>.
bool size_zero(const T &x)
Returns 1 if input is of length 0, returns 0 otherwise.
void check_bounded(const char *function, const char *name, const T_y &y, const T_low &low, const T_high &high)
Check if the value is between the low and high values, inclusively.
void throw_domain_error(const char *function, const char *name, const T &y, const char *msg1, const char *msg2)
Throw a domain error with a consistently formatted message.
void throw_domain_error_vec(const char *function, const char *name, const T &y, size_t i, const char *msg1, const char *msg2)
Throw a domain error with a consistently formatted message.
int64_t max_size(const T1 &x1, const Ts &... xs)
Calculate the size of the largest input.
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...
static void check(const char *function, const char *name, const T_y &y, const T_low &low, const T_high &high)
static void check(const char *function, const char *name, const T_y &y, const T_low &low, const T_high &high)