1 #ifndef STAN_MATH_PRIM_SCAL_ERR_CHECK_GREATER_HPP
2 #define STAN_MATH_PRIM_SCAL_ERR_CHECK_GREATER_HPP
16 template <
typename T_y,
20 static bool check(
const char*
function,
25 VectorView<const T_low> low_vec(low);
26 for (
size_t n = 0; n <
length(low); n++) {
27 if (!(y > low_vec[n])) {
28 std::stringstream msg;
29 msg <<
", but must be greater than ";
31 std::string msg_str(msg.str());
33 "is ", msg_str.c_str());
40 template <
typename T_y,
42 struct greater<T_y, T_low, true> {
43 static bool check(
const char*
function,
48 VectorView<const T_low> low_vec(low);
49 for (
size_t n = 0; n <
length(y); n++) {
51 std::stringstream msg;
52 msg <<
", but must be greater than ";
54 std::string msg_str(msg.str());
56 "is ", msg_str.c_str());
83 template <
typename T_y,
typename T_low>
88 return greater<T_y, T_low, is_vector_like<T_y>::value>
89 ::check(
function, name, y, low);
size_t length(const std::vector< T > &x)
void domain_error_vec(const char *function, const char *name, const T &y, const size_t i, const char *msg1, const char *msg2)
Throw a domain error with a consistently formatted message.
T get(const std::vector< T > &x, size_t n)
void 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.
bool check_greater(const char *function, const char *name, const T_y &y, const T_low &low)
Return true if y is strictly greater than low.