Stan Math Library
4.9.0
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
4
#include <
stan/math/prim/meta.hpp
>
5
#include <
stan/math/prim/fun/Eigen.hpp
>
6
#include <algorithm>
7
#include <vector>
8
9
namespace
stan
{
10
namespace
math {
11
19
template
<
typename
T>
20
inline
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
34
template
<
typename
T,
typename
= require_vector_t<T>>
35
inline
auto
reverse
(
const
T& x) {
36
return
x.reverse();
37
}
38
39
}
// namespace math
40
}
// namespace stan
41
#endif
Eigen.hpp
stan::math::reverse
auto reverse(T_x &&x)
Return reversed view into the specified vector or row vector.
Definition
reverse.hpp:20
stan
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...
Definition
unit_vector_constrain.hpp:15
meta.hpp
stan
math
prim
fun
reverse.hpp
[
Stan Home Page
]
© 2011–2019, Stan Development Team.