| Stan Math Library 2.12.0 reverse mode automatic differentiation

- Main Page
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

sort_desc.hpp
Go to the documentation of this file.
1 #ifndef STAN_MATH_PRIM_MAT_FUN_SORT_DESC_HPP
2 #define STAN_MATH_PRIM_MAT_FUN_SORT_DESC_HPP
3
4 #include <stan/math/prim/mat/fun/Eigen.hpp>
5 #include <stan/math/prim/mat/fun/value_of_rec.hpp>
6 #include <stan/math/prim/scal/err/check_not_nan.hpp>
7 #include <algorithm>
8 #include <functional>
9
10 namespace stan {
11 namespace math {
12
21 template <typename T, int R, int C>
22 inline Eigen::Matrix<T, R, C> sort_desc(Eigen::Matrix<T, R, C> xs) {
23 check_not_nan("sort_asc", "container argument", xs);
24 std::sort(xs.data(), xs.data() + xs.size(), std::greater<T>());
25 return xs;
26 }
27
28 }
29 }
30 #endif
check_not_nan.hpp
value_of_rec.hpp
stan::math::check_not_nan
bool check_not_nan(const char *function, const char *name, const T_y &y)
Return true if y is not NaN.
Definition: check_not_nan.hpp:60
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
Eigen.hpp

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