sort_desc.hpp
Go to the documentation of this file.
#ifndef STAN_MATH_PRIM_ARR_FUN_SORT_DESC_HPP
#define STAN_MATH_PRIM_ARR_FUN_SORT_DESC_HPP
#include <stan/math/prim/scal/err/check_not_nan.hpp>
#include <algorithm>
#include <functional>
#include <vector>
namespace stan {
namespace math {
template <typename T>
inline std::vector<T> sort_desc(std::vector<T> xs) {
check_not_nan("sort_asc", "container argument", xs);
std::sort(xs.begin(), xs.end(), std::greater<T>());
return xs;
}
}
}
#endif
check_not_nan.hpp
stan
Definition: log_sum_exp.hpp:8
stan::math::sort_desc
std::vector< T > sort_desc(std::vector< T > xs)
Return the specified standard vector in descending order.
Definition: sort_desc.hpp:21
stan::math::check_not_nan
void check_not_nan(const char *function, const char *name, const T_y &y)
Check if y is not NaN.
Definition: check_not_nan.hpp:57

[ Stan Home Page ] © 2011–2016, Stan Development Team.