Automatic Differentiation
 
Loading...
Searching...
No Matches
reverse.hpp
Go to the documentation of this file.
1#ifndef STAN_MATH_OPENCL_PRIM_REVERSE_HPP
2#define STAN_MATH_OPENCL_PRIM_REVERSE_HPP
3#ifdef STAN_OPENCL
4
7
8namespace stan {
9namespace math {
10
18template <typename T_x,
19 require_all_kernel_expressions_and_none_scalar_t<T_x>* = nullptr>
20inline auto reverse(T_x&& x) {
21 check_vector("reverse(OpenCL)", "x", x);
22 return indexing(std::forward<T_x>(x),
23 x.rows() - row_index(x.rows(), x.cols()) - 1,
24 x.cols() - col_index() - 1);
25}
26} // namespace math
27} // namespace stan
28#endif
29#endif
Represents operation that determines column index.
Definition index.hpp:80
int cols() const
Number of columns of a matrix that would be the result of evaluating this expression.
Definition index.hpp:66
Represents operation that determines row index.
Definition index.hpp:17
auto indexing(T_mat &&mat, T_row_index &&row_index, T_col_index &&col_index)
Index a kernel generator expression using two expressions for indices.
Definition indexing.hpp:304
void check_vector(const char *function, const char *name, const Mat &x)
Check the input is either a row vector or column vector or a matrix with a single row or column.
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 ...