1 #ifndef STAN__MATH__MATRIX__SORT_HPP
2 #define STAN__MATH__MATRIX__SORT_HPP
20 inline typename std::vector<T>
sort_asc(std::vector<T> xs) {
21 std::sort(xs.begin(), xs.end());
33 inline typename std::vector<T>
sort_desc(std::vector<T> xs) {
34 std::sort(xs.begin(), xs.end(), std::greater<T>());
45 template <
typename T,
int R,
int C>
46 inline typename Eigen::Matrix<T,R,C>
sort_asc(Eigen::Matrix<T,R,C> xs) {
47 std::sort(xs.data(), xs.data()+xs.size());
58 template <
typename T,
int R,
int C>
59 inline typename Eigen::Matrix<T,R,C>
sort_desc(Eigen::Matrix<T,R,C> xs) {
60 std::sort(xs.data(), xs.data()+xs.size(), std::greater<T>());
std::vector< T > sort_desc(std::vector< T > xs)
Return the specified standard vector in descending order.
std::vector< T > sort_asc(std::vector< T > xs)
Return the specified standard vector in ascending order.