1#ifndef STAN_MATH_OPENCL_KERNELS_UNPACK_HPP
2#define STAN_MATH_OPENCL_KERNELS_UNPACK_HPP
11namespace opencl_kernels {
13static constexpr const char* unpack_kernel_code =
STRINGIFY(
32 __kernel
void unpack(__global
double* B, __global
double* A,
33 unsigned int rows,
unsigned int cols,
35 int i = get_global_id(0);
36 int j = get_global_id(1);
40 const int column_offset = j *
rows - (j * (j - 1)) / 2;
41 const int row_offset = (i - j);
43 B(i, j) = A[column_offset + row_offset];
48 const int column_offset = j * (j + 1) / 2;
50 B(i, j) = A[column_offset + i];
const kernel_cl< out_buffer, in_buffer, int, int, matrix_cl_view > unpack("unpack", {indexing_helpers, unpack_kernel_code})
See the docs for unpack() .
int64_t cols(const T_x &x)
Returns the number of columns in the specified kernel generator expression.
int64_t rows(const T_x &x)
Returns the number of rows in the specified kernel generator expression.
static const std::string indexing_helpers
Defines helper macros for common matrix indexing operations.
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...
Creates functor for kernels.