Stan Math Library  2.20.0
reverse mode automatic differentiation
triangular_transpose.hpp
Go to the documentation of this file.
1 #ifndef STAN_MATH_OPENCL_KERNELS_TRIANGULAR_TRANSPOSE_HPP
2 #define STAN_MATH_OPENCL_KERNELS_TRIANGULAR_TRANSPOSE_HPP
3 #ifdef STAN_OPENCL
4 
7 
8 namespace stan {
9 namespace math {
10 namespace opencl_kernels {
11 // \cond
12 static const char* triangular_transpose_kernel_code = STRINGIFY(
13  // \endcond
29  __kernel void triangular_transpose(__global double* A, unsigned int rows,
30  unsigned int cols,
31  unsigned int copy_direction) {
32  int i = get_global_id(0);
33  int j = get_global_id(1);
34  if (i < rows && j < cols) {
35  if (copy_direction == LOWER_TO_UPPER && i > j) {
36  A(j, i) = A(i, j);
37  } else if (copy_direction == UPPER_TO_LOWER && i > j) {
38  A(i, j) = A(j, i);
39  }
40  }
41  }
42  // \cond
43 );
44 // \endcond
45 
51  "triangular_transpose",
52  {indexing_helpers, triangular_transpose_kernel_code});
53 
54 } // namespace opencl_kernels
55 } // namespace math
56 } // namespace stan
57 #endif
58 #endif
int rows(const Eigen::Matrix< T, R, C > &m)
Return the number of rows in the specified matrix, vector, or row vector.
Definition: rows.hpp:20
#define STRINGIFY(src)
Definition: kernel_cl.hpp:22
static const char * indexing_helpers
Definition: helpers.hpp:14
const kernel_cl< in_out_buffer, int, int, TriangularMapCL > triangular_transpose("triangular_transpose", {indexing_helpers, triangular_transpose_kernel_code})
See the docs for triangular_transpose() .
int cols(const Eigen::Matrix< T, R, C > &m)
Return the number of columns in the specified matrix, vector, or row vector.
Definition: cols.hpp:20
Creates functor for kernels.
Definition: kernel_cl.hpp:201

     [ Stan Home Page ] © 2011–2018, Stan Development Team.