1 #ifndef STAN_MATH_OPENCL_KERNELS_IDENTITY_HPP 2 #define STAN_MATH_OPENCL_KERNELS_IDENTITY_HPP 10 namespace opencl_kernels {
12 static const char* identity_kernel_code =
STRINGIFY(
27 int i = get_global_id(0);
28 int j = get_global_id(1);
29 if (i < rows && j < cols) {
41 static const char* batch_identity_kernel_code =
STRINGIFY(
71 int batch_id = get_global_id(0);
73 int batch_row = get_global_id(1);
74 int batch_col = get_global_id(2);
75 int index = batch_id * batch_rows * batch_rows + batch_col * batch_rows
79 if (batch_row == batch_col) {
95 identity_kernel_code});
int rows(const Eigen::Matrix< T, R, C > &m)
Return the number of rows in the specified matrix, vector, or row vector.
static const char * indexing_helpers
const kernel_cl< out_buffer, int, int > batch_identity("batch_identity", {indexing_helpers, batch_identity_kernel_code})
See the docs for batch_identity() .
int cols(const Eigen::Matrix< T, R, C > &m)
Return the number of columns in the specified matrix, vector, or row vector.
const kernel_cl< out_buffer, int, int > identity("identity", {indexing_helpers, identity_kernel_code})
See the docs for identity() .
int size(const std::vector< T > &x)
Return the size of the specified standard vector.
Creates functor for kernels.