Automatic Differentiation
 
Loading...
Searching...
No Matches
is_ordered.hpp
Go to the documentation of this file.
1#ifndef STAN_MATH_PRIM_ERR_IS_ORDERED_HPP
2#define STAN_MATH_PRIM_ERR_IS_ORDERED_HPP
3
5#include <vector>
6#include <string>
7
8namespace stan {
9namespace math {
10
18template <typename T_y>
19inline bool is_ordered(const std::vector<T_y>& y) {
20 for (size_t n = 1; n < y.size(); ++n) {
21 if (!(y[n] > y[n - 1])) {
22 return false;
23 }
24 }
25 return true;
26}
27
28} // namespace math
29} // namespace stan
30#endif
bool is_ordered(const std::vector< T_y > &y)
Return true if the vector is sorted into strictly increasing order.
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...