1#ifndef STAN_MATH_OPENCL_PRIM_TAIL_HPP
2#define STAN_MATH_OPENCL_PRIM_TAIL_HPP
22template <
typename T_x,
23 require_nonscalar_prim_or_rev_kernel_expression_t<T_x>* =
nullptr>
24inline auto tail(T_x&& x,
size_t n) {
30 return block(std::forward<T_x>(x), 1, 1 + x.cols() - n, 1, n);
32 return block(std::forward<T_x>(x), 1 + x.rows() - n, 1, n, 1);
void check_vector_index(const char *function, const char *name, const T &y, size_t i)
Check if the specified index is a valid element of the row or column vector This check is 1-indexed b...
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 block(T_x &&x, size_t i, size_t j, size_t nrows, size_t ncols)
Return a nrows x ncols submatrix starting at (i-1, j-1).
auto tail(T_x &&x, size_t n)
Return the specified number of elements as a vector or row vector (same as input) from the back of th...
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...