1#ifndef STAN_MATH_OPENCL_KERNELS_CHECK_SYMMETRIC_HPP
2#define STAN_MATH_OPENCL_KERNELS_CHECK_SYMMETRIC_HPP
11namespace opencl_kernels {
13static constexpr const char *is_symmetric_kernel_code =
STRINGIFY(
30 unsigned int rows,
unsigned int cols,
32 const int i = get_global_id(0);
33 const int j = get_global_id(1);
35 double diff =
fabs(A(i, j) - A(j, i));
36 if (diff > tolerance) {
__kernel void is_symmetric(__global double *A, __global int *flag, unsigned int rows, unsigned int cols, double tolerance)
Check if the matrix_cl is symmetric.
const kernel_cl< in_buffer, out_buffer, int, int, const double > check_symmetric("is_symmetric", {indexing_helpers, is_symmetric_kernel_code})
See the docs for check_symmetric() .
int64_t cols(const T_x &x)
Returns the number of columns in the specified kernel generator expression.
int64_t rows(const T_x &x)
Returns the number of rows in the specified kernel generator expression.
static const std::string indexing_helpers
Defines helper macros for common matrix indexing operations.
fvar< T > fabs(const fvar< T > &x)
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...
Creates functor for kernels.