Automatic Differentiation
 
Loading...
Searching...
No Matches
reverse.hpp
Go to the documentation of this file.
1#ifndef STAN_MATH_PRIM_FUN_REVERSE_HPP
2#define STAN_MATH_PRIM_FUN_REVERSE_HPP
3
6#include <algorithm>
7#include <vector>
8
9namespace stan {
10namespace math {
11
19template <typename T>
20inline std::vector<T> reverse(const std::vector<T>& x) {
21 std::vector<T> rev(x.size());
22 std::reverse_copy(x.begin(), x.end(), rev.begin());
23 return rev;
24}
25
34template <typename T, typename = require_vector_t<T>>
35inline auto reverse(const T& x) {
36 return x.reverse();
37}
38
39} // namespace math
40} // namespace stan
41#endif
auto reverse(T_x &&x)
Return reversed view into the specified vector or row vector.
Definition reverse.hpp:20
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...