1#ifndef STAN_MATH_OPENCL_PRIM_CUMULATIVE_SUM_HPP
2#define STAN_MATH_OPENCL_PRIM_CUMULATIVE_SUM_HPP
23template <
typename T_vec,
24 require_all_kernel_expressions_and_none_scalar_t<T_vec>* =
nullptr>
40 const int work_groups = std::min(
41 (v.size() + local_size - 1) / local_size,
49 = static_select<is_matrix_cl<T_vec>::value>(v, res);
55 cl::NDRange(local_size * work_groups), cl::NDRange(local_size), tmp_wgs,
56 tmp_threads, in, v.
size());
58 cl::NDRange(local_size2),
59 tmp_wgs, work_groups);
61 cl::NDRange(local_size * work_groups), cl::NDRange(local_size), res, in,
62 tmp_threads, tmp_wgs, v.
size());
63 }
catch (
const cl::Error&
e) {
Represents an arithmetic matrix on the OpenCL device.
The API to access the methods and values in opencl_context_base.
void check_opencl_error(const char *function, const cl::Error &e)
Throws the domain error with specifying the OpenCL error that occurred.
std::vector< cl::Device > & device() noexcept
Returns a vector containing the OpenCL device used to create the context.
static constexpr double e()
Return the base of the natural logarithm.
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 cumulative_sum(T_vec &&v)
Return the cumulative sum of the specified vector.
typename scalar_type< T >::type scalar_type_t
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...
Checks if the decayed type of T is a matrix_cl.
struct containing cumulative_sum kernels, grouped by scalar type.