Stan Math Library  2.20.0
reverse mode automatic differentiation
check_diagonal_zeros.hpp
Go to the documentation of this file.
1 #ifndef STAN_MATH_OPENCL_KERNELS_CHECK_DIAGONAL_ZEROS_HPP
2 #define STAN_MATH_OPENCL_KERNELS_CHECK_DIAGONAL_ZEROS_HPP
3 #ifdef STAN_OPENCL
4 
7 
8 namespace stan {
9 namespace math {
10 namespace opencl_kernels {
11 // \cond
12 static const char *is_zero_on_diagonal_kernel_code = STRINGIFY(
13  // \endcond
26  __kernel void is_zero_on_diagonal(__global double *A, __global int *flag,
27  unsigned int rows, unsigned int cols) {
28  const int i = get_global_id(0);
29  if (i < rows && i < cols) {
30  if (A(i, i) == 0) {
31  flag[0] = 1;
32  }
33  }
34  }
35  // \cond
36 );
37 // \endcond
38 
44  "is_zero_on_diagonal", {indexing_helpers, is_zero_on_diagonal_kernel_code});
45 
46 } // namespace opencl_kernels
47 } // namespace math
48 } // namespace stan
49 #endif
50 #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
__kernel void is_zero_on_diagonal(__global double *A, __global int *flag, unsigned int rows, unsigned int cols)
Check if the matrix_cl has zeros on the diagonal.
#define STRINGIFY(src)
Definition: kernel_cl.hpp:22
static const char * indexing_helpers
Definition: helpers.hpp:14
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
const kernel_cl< in_buffer, out_buffer, int, int > check_diagonal_zeros("is_zero_on_diagonal", {indexing_helpers, is_zero_on_diagonal_kernel_code})
See the docs for check_diagonal_zeros() .

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