1#ifndef STAN_MATH_PRIM_ERR_CHECK_ORDERED_HPP
2#define STAN_MATH_PRIM_ERR_CHECK_ORDERED_HPP
28template <
typename T_y, require_vector_t<T_y>* =
nullptr,
29 require_not_std_vector_t<T_y>* =
nullptr>
33 for (Eigen::Index n = 1; n < y_ref.size(); n++) {
34 if (!(y_ref[n] > y_ref[n - 1])) {
36 std::ostringstream msg1;
37 msg1 <<
"is not a valid ordered vector."
39 std::string msg1_str(msg1.str());
40 std::ostringstream msg2;
41 msg2 <<
", but should be greater than the previous element, "
43 std::string msg2_str(msg2.str());
61template <
typename T_y, require_std_vector_vt<is_stan_scalar, T_y>* =
nullptr>
64 for (
size_t n = 1; n < y.size(); n++) {
65 if (!(y[n] > y[n - 1])) {
67 std::ostringstream msg1;
68 msg1 <<
"is not a valid ordered vector."
70 std::string msg1_str(msg1.str());
71 std::ostringstream msg2;
72 msg2 <<
", but should be greater than the previous element, "
74 std::string msg2_str(msg2.str());
92template <
typename T_y, require_std_vector_t<T_y>* =
nullptr,
93 require_not_vt_stan_scalar<T_y>* =
nullptr>
94inline void check_ordered(
const char* function,
const char* name,
96 for (
size_t i = 0; i < y.size(); ++i) {
auto make_iter_name(const char *name)
double value_of_rec(const fvar< T > &v)
Return the value of the specified variable.
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.
ref_type_t< T && > to_ref(T &&a)
This evaluates expensive Eigen expressions.
void check_ordered(const char *function, const char *name, const T_y &y)
Throw an exception if the specified vector is not sorted into strictly increasing order.
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...