Stan Math Library  2.20.0
reverse mode automatic differentiation
subtract.hpp
Go to the documentation of this file.
1 #ifndef STAN_MATH_OPENCL_KERNELS_SUBTRACT_HPP
2 #define STAN_MATH_OPENCL_KERNELS_SUBTRACT_HPP
3 #ifdef STAN_OPENCL
4 
7 
8 namespace stan {
9 namespace math {
10 namespace opencl_kernels {
11 // \cond
12 static const char *subtract_kernel_code = STRINGIFY(
13  // \endcond
30  __kernel void subtract(__global double *C, __global double *A,
31  __global double *B, unsigned int rows,
32  unsigned int cols) {
33  int i = get_global_id(0);
34  int j = get_global_id(1);
35  if (i < rows && j < cols) {
36  C(i, j) = A(i, j) - B(i, j);
37  }
38  }
39  // \cond
40 );
41 // \endcond
42 
47  "subtract", {indexing_helpers, subtract_kernel_code});
48 
49 } // namespace opencl_kernels
50 } // namespace math
51 } // namespace stan
52 #endif
53 #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< out_buffer, in_buffer, in_buffer, int, int > subtract("subtract", {indexing_helpers, subtract_kernel_code})
See the docs for subtract() .
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.