Stan Math Library
2.20.0
reverse mode automatic differentiation
stan
math
prim
arr
err
is_ordered.hpp
Go to the documentation of this file.
1
#ifndef STAN_MATH_PRIM_ARR_ERR_IS_ORDERED_HPP
2
#define STAN_MATH_PRIM_ARR_ERR_IS_ORDERED_HPP
3
4
#include <
stan/math/prim/meta.hpp
>
5
#include <vector>
6
#include <string>
7
8
namespace
stan
{
9
namespace
math {
10
18
template
<
typename
T_y>
19
inline
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
return
true
;
25
}
26
27
}
// namespace math
28
}
// namespace stan
29
#endif
stan
Definition:
log_sum_exp.hpp:8
meta.hpp
stan::math::is_ordered
bool is_ordered(const std::vector< T_y > &y)
Return true if the vector is sorted into strictly increasing order.
Definition:
is_ordered.hpp:19
[
Stan Home Page
]
© 2011–2018, Stan Development Team.