Stan Math Library: stan/math/rev/mat/fun/sort_asc.hpp Source File

| Stan Math Library 2.10.0 reverse mode automatic differentiation

- Main Page
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

sort_asc.hpp
Go to the documentation of this file.
1 #ifndef STAN_MATH_REV_MAT_FUN_SORT_ASC_HPP
2 #define STAN_MATH_REV_MAT_FUN_SORT_ASC_HPP
3
4 #include <stan/math/rev/core.hpp>
5 #include <stan/math/prim/mat/fun/Eigen.hpp>
6 #include <algorithm> // std::sort
7 #include <functional> // std::greater
8 #include <valarray>
9 #include <vector>
10
11 namespace stan {
12 namespace math {
13
21 inline std::vector<var> sort_asc(std::vector<var> xs) {
22 std::sort(xs.begin(), xs.end());
23 return xs;
24 }
25
33 template <int R, int C>
34 inline typename Eigen::Matrix<var, R, C>
35 sort_asc(Eigen::Matrix<var, R, C> xs) {
36 std::sort(xs.data(), xs.data()+xs.size());
37 return xs;
38 }
39
40 }
41 }
42 #endif
core.hpp
stan
Definition: log_sum_exp.hpp:8
Eigen.hpp
stan::math::sort_asc
std::vector< fvar< T > > sort_asc(std::vector< fvar< T > > xs)
Definition: sort_asc.hpp:17

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