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>
30void check_ordered(
const char* function,
const char* name,
const T_y& y) {
32 for (Eigen::Index n = 1; n < y_ref.size(); n++) {
33 if (!(y_ref[n] > y_ref[n - 1])) {
35 std::ostringstream msg1;
36 msg1 <<
"is not a valid ordered vector."
38 std::string msg1_str(msg1.str());
39 std::ostringstream msg2;
40 msg2 <<
", but should be greater than the previous element, "
42 std::string msg2_str(msg2.str());
60template <
typename T_y, require_std_vector_vt<is_stan_scalar, T_y>* =
nullptr>
61void check_ordered(
const char* function,
const char* name,
const T_y& y) {
62 for (
size_t n = 1; n < y.size(); n++) {
63 if (!(y[n] > y[n - 1])) {
65 std::ostringstream msg1;
66 msg1 <<
"is not a valid ordered vector."
68 std::string msg1_str(msg1.str());
69 std::ostringstream msg2;
70 msg2 <<
", but should be greater than the previous element, "
72 std::string msg2_str(msg2.str());
90template <
typename T_y, require_std_vector_t<T_y>* =
nullptr,
91 require_not_vt_stan_scalar<T_y>* =
nullptr>
92void check_ordered(
const char* function,
const char* name,
const T_y& y) {
93 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 ...