1 #ifndef STAN__MATH__ERROR_HANDLING__MATRIX__CHECK_ORDERED_HPP
2 #define STAN__MATH__ERROR_HANDLING__MATRIX__CHECK_ORDERED_HPP
28 template <
typename T_y,
typename T_result>
30 const Eigen::Matrix<T_y,Eigen::Dynamic,1>& y,
40 for (
size_t n = 1; n < y.size(); n++) {
41 if (!(y[n] > y[n-1])) {
42 std::ostringstream stream;
43 stream <<
" is not a valid ordered vector."
45 <<
" is %1%, but should be greater than the previous element, "
47 std::string msg(stream.str());
48 return dom_err(
function,y[n],name,
56 template <
typename T_y,
typename T_result>
58 const std::vector<T_y>& y,
64 for (
int n = 1; n < y.size(); n++) {
65 if (!(y[n] > y[n-1])) {
66 std::ostringstream stream;
67 stream <<
" is not a valid ordered vector."
69 <<
" is %1%, but should be greater than the previous element, "
71 std::string msg(stream.str());
72 return dom_err(
function,y[n],name,
82 const Eigen::Matrix<T,Eigen::Dynamic,1>& y,
85 return check_ordered<T,T>(
function,y,name,result);
89 const std::vector<T>& y,
92 return check_ordered<T,T>(
function,y,name,result);
bool check_ordered(const char *function, const Eigen::Matrix< T_y, Eigen::Dynamic, 1 > &y, const char *name, T_result *result)
Return true if the specified vector is sorted into increasing order.
bool dom_err(const char *function, const T &y, const char *name, const char *error_msg, const T_msg error_msg2, T_result *result)
Primary template class for the metaprogram to compute the index type of a container.