Stan Math Library  2.20.0
reverse mode automatic differentiation
copy_triangular.hpp
Go to the documentation of this file.
1 #ifndef STAN_MATH_OPENCL_COPY_TRIANGULAR_HPP
2 #define STAN_MATH_OPENCL_COPY_TRIANGULAR_HPP
3 #ifdef STAN_OPENCL
9 #include <CL/cl.hpp>
10 
11 namespace stan {
12 namespace math {
13 
29 template <TriangularViewCL triangular_view = TriangularViewCL::Entire>
30 inline matrix_cl copy_triangular(const matrix_cl& src) {
31  if (src.size() == 0 || src.size() == 1) {
32  matrix_cl dst(src);
33  return dst;
34  }
35  matrix_cl dst(src.rows(), src.cols());
36  try {
37  opencl_kernels::copy_triangular(cl::NDRange(dst.rows(), dst.cols()), dst,
38  src, dst.rows(), dst.cols(),
39  triangular_view);
40  } catch (const cl::Error& e) {
41  check_opencl_error("copy_triangular", e);
42  }
43  return dst;
44 }
45 } // namespace math
46 } // namespace stan
47 
48 #endif
49 #endif
The matrix_cl class - allocates memory space on the OpenCL device, functions for transfering matrices...
matrix_cl copy_triangular(const matrix_cl &src)
Copies the lower or upper triangular of the source matrix to the destination matrix.
const kernel_cl< out_buffer, in_buffer, int, int, TriangularViewCL > copy_triangular("copy_triangular", {indexing_helpers, copy_triangular_kernel_code})
See the docs for copy_triangular() .
Represents a matrix on the OpenCL device.
Definition: matrix_cl.hpp:29
checking OpenCL error numbers
double e()
Return the base of the natural logarithm.
Definition: constants.hpp:87
void check_opencl_error(const char *function, const cl::Error &e)
Throws the domain error with specifying the OpenCL error that occured.

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