1 #ifndef STAN_MATH_PRIM_MAT_FUN_RANK_HPP
2 #define STAN_MATH_PRIM_MAT_FUN_RANK_HPP
18 inline size_t rank(
const std::vector<T> & v,
int s) {
20 size_t size = v.size();
25 for (
size_t i = 0U; i <
size; ++i)
37 template <
typename T,
int R,
int C>
38 inline size_t rank(
const Eigen::Matrix<T, R, C> & v,
int s) {
40 size_t size = v.size();
44 const T * vv = v.data();
47 for (
size_t i = 0U; i <
size; ++i)
bool check_range(const char *function, const char *name, const int max, const int index, const int nested_level, const char *error_msg)
Return true if specified index is within range.
int size(const std::vector< T > &x)
size_t rank(const std::vector< T > &v, int s)
Return the number of components of v less than v[s].