1 #ifndef STAN_MATH_OPENCL_KERNELS_PACK_HPP 2 #define STAN_MATH_OPENCL_KERNELS_PACK_HPP 10 namespace opencl_kernels {
12 static const char* pack_kernel_code =
STRINGIFY(
30 __kernel
void pack(__global
double* A, __global
double* B,
31 unsigned int rows,
unsigned int cols,
33 int i = get_global_id(0);
34 int j = get_global_id(1);
35 if (i < rows && j < cols) {
38 const int column_offset = j * rows - (j * (j - 1)) / 2;
39 const int row_offset = (i - j);
41 A[column_offset + row_offset] = B(i, j);
44 const int column_offset = j * (j + 1) / 2;
46 A[column_offset + i] = B(i, j);
int rows(const Eigen::Matrix< T, R, C > &m)
Return the number of rows in the specified matrix, vector, or row vector.
const kernel_cl< out_buffer, in_buffer, int, int, TriangularViewCL > pack("pack", {indexing_helpers, pack_kernel_code})
See the docs for pack() .
static const char * indexing_helpers
int cols(const Eigen::Matrix< T, R, C > &m)
Return the number of columns in the specified matrix, vector, or row vector.
Creates functor for kernels.