Stan Math Library  2.20.0
reverse mode automatic differentiation
scalar_mul_diagonal.hpp
Go to the documentation of this file.
1 #ifndef STAN_MATH_OPENCL_KERNELS_SCALAR_MUL_DIAGONAL_HPP
2 #define STAN_MATH_OPENCL_KERNELS_SCALAR_MUL_DIAGONAL_HPP
3 #ifdef STAN_OPENCL
4 
7 
8 namespace stan {
9 namespace math {
10 namespace opencl_kernels {
11 // \cond
12 static const char *scalar_mul_diagonal_kernel_code = STRINGIFY(
13  // \endcond
22  __kernel void scalar_mul_diagonal(__global double *A, const double scalar,
23  const unsigned int rows,
24  const unsigned int min_dim) {
25  int i = get_global_id(0);
26  if (i < min_dim) {
27  A(i, i) *= scalar;
28  }
29  }
30  // \cond
31 );
32 // \endcond
33 
38  "scalar_mul_diagonal", {indexing_helpers, scalar_mul_diagonal_kernel_code});
39 
40 } // namespace opencl_kernels
41 } // namespace math
42 } // namespace stan
43 #endif
44 #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
const kernel_cl< in_out_buffer, double, int, int > scalar_mul_diagonal("scalar_mul_diagonal", {indexing_helpers, scalar_mul_diagonal_kernel_code})
See the docs for add() .
#define STRINGIFY(src)
Definition: kernel_cl.hpp:22
static const char * indexing_helpers
Definition: helpers.hpp:14
Creates functor for kernels.
Definition: kernel_cl.hpp:201

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