1 #ifndef STAN_MATH_PRIM_MAT_ERR_CHECK_ORDERED_HPP
2 #define STAN_MATH_PRIM_MAT_ERR_CHECK_ORDERED_HPP
30 template <
typename T_y>
33 const Eigen::Matrix<T_y, Eigen::Dynamic, 1>& y) {
43 for (
size_t n = 1; n < y.size(); n++) {
44 if (!(y[n] > y[n-1])) {
45 std::ostringstream msg1;
46 msg1 <<
"is not a valid ordered vector."
49 std::string msg1_str(msg1.str());
50 std::ostringstream msg2;
51 msg2 <<
", but should be greater than the previous element, "
53 std::string msg2_str(msg2.str());
55 msg1_str.c_str(), msg2_str.c_str());
77 template <
typename T_y>
80 const std::vector<T_y>& y) {
84 for (
size_t n = 1; n < y.size(); n++) {
85 if (!(y[n] > y[n-1])) {
86 std::ostringstream msg1;
87 msg1 <<
"is not a valid ordered vector."
90 std::string msg1_str(msg1.str());
91 std::ostringstream msg2;
92 msg2 <<
", but should be greater than the previous element, "
94 std::string msg2_str(msg2.str());
96 msg1_str.c_str(), msg2_str.c_str());
Primary template class for the metaprogram to compute the index type of a container.
bool check_ordered(const char *function, const char *name, const Eigen::Matrix< T_y, Eigen::Dynamic, 1 > &y)
Return true if the specified vector is sorted into strictly increasing order.
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.