1#ifndef STAN_MATH_OPENCL_KERNELS_PACK_HPP 
    2#define STAN_MATH_OPENCL_KERNELS_PACK_HPP 
   11namespace opencl_kernels {
 
   13static constexpr const char* pack_kernel_code = 
STRINGIFY(
 
   31    __kernel 
void pack(__global 
double* A, __global 
double* B,
 
   32                       unsigned int rows, 
unsigned int cols,
 
   34      int i = get_global_id(0);
 
   35      int j = get_global_id(1);
 
   39          const int column_offset = j * 
rows - (j * (j - 1)) / 2;
 
   40          const int row_offset = (i - j);
 
   42            A[column_offset + row_offset] = B(i, j);
 
   45          const int column_offset = j * (j + 1) / 2;
 
   47            A[column_offset + i] = B(i, j);
 
const kernel_cl< out_buffer, in_buffer, int, int, matrix_cl_view > pack("pack", {indexing_helpers, pack_kernel_code})
See the docs for pack() .
 
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.